Author: hardy.ferentschik
Date: 2008-06-11 03:33:15 -0400 (Wed, 11 Jun 2008)
New Revision: 14760
Added:
annotations/trunk/src/test/org/hibernate/test/annotations/id/UUIDGenerator.java
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Ball.java
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/BreakDance.java
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Bunny.java
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Computer.java
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Department.java
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Dog.java
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/FirTree.java
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Footballer.java
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/FootballerPk.java
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Furniture.java
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/GoalKeeper.java
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Home.java
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Location.java
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/MilitaryBuilding.java
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Monkey.java
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Phone.java
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/PointyTooth.java
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Shoe.java
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/SoundSystem.java
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Store.java
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Tower.java
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Tree.java
Removed:
annotations/trunk/src/test/org/hibernate/test/annotations/id/Ball.java
annotations/trunk/src/test/org/hibernate/test/annotations/id/BreakDance.java
annotations/trunk/src/test/org/hibernate/test/annotations/id/Computer.java
annotations/trunk/src/test/org/hibernate/test/annotations/id/Department.java
annotations/trunk/src/test/org/hibernate/test/annotations/id/Dog.java
annotations/trunk/src/test/org/hibernate/test/annotations/id/FirTree.java
annotations/trunk/src/test/org/hibernate/test/annotations/id/Footballer.java
annotations/trunk/src/test/org/hibernate/test/annotations/id/FootballerPk.java
annotations/trunk/src/test/org/hibernate/test/annotations/id/Furniture.java
annotations/trunk/src/test/org/hibernate/test/annotations/id/GoalKeeper.java
annotations/trunk/src/test/org/hibernate/test/annotations/id/Home.java
annotations/trunk/src/test/org/hibernate/test/annotations/id/Location.java
annotations/trunk/src/test/org/hibernate/test/annotations/id/MilitaryBuilding.java
annotations/trunk/src/test/org/hibernate/test/annotations/id/Monkey.java
annotations/trunk/src/test/org/hibernate/test/annotations/id/Phone.java
annotations/trunk/src/test/org/hibernate/test/annotations/id/Shoe.java
annotations/trunk/src/test/org/hibernate/test/annotations/id/SoundSystem.java
annotations/trunk/src/test/org/hibernate/test/annotations/id/Store.java
annotations/trunk/src/test/org/hibernate/test/annotations/id/Tower.java
annotations/trunk/src/test/org/hibernate/test/annotations/id/Tree.java
Modified:
annotations/trunk/src/test/org/hibernate/test/annotations/id/IdClassTest.java
annotations/trunk/src/test/org/hibernate/test/annotations/id/IdTest.java
Log:
ANN-748:
- Added test case for
- Seperated test classes from test entities to make things a little easier to find
Deleted: annotations/trunk/src/test/org/hibernate/test/annotations/id/Ball.java
===================================================================
--- annotations/trunk/src/test/org/hibernate/test/annotations/id/Ball.java 2008-06-10
14:14:15 UTC (rev 14759)
+++ annotations/trunk/src/test/org/hibernate/test/annotations/id/Ball.java 2008-06-11
07:33:15 UTC (rev 14760)
@@ -1,34 +0,0 @@
-//$Id$
-package org.hibernate.test.annotations.id;
-
-import java.io.Serializable;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.TableGenerator;
-
-/**
- * Sample of table generator
- *
- * @author Emmanuel Bernard
- */
-@TableGenerator(name = "EMP_GEN", table = "GENERATOR_TABLE",
pkColumnName = "pkey",
- valueColumnName = "hi", pkColumnValue = "Ball", allocationSize =
10)
-@Entity
-public class Ball implements Serializable {
- private Integer id;
-
- @Id
- @GeneratedValue(strategy = GenerationType.TABLE, generator = "EMP_GEN")
- @Column(name = "ball_id")
- public Integer getId() {
- return id;
- }
-
- public void setId(Integer id) {
- this.id = id;
- }
-
-}
Deleted: annotations/trunk/src/test/org/hibernate/test/annotations/id/BreakDance.java
===================================================================
---
annotations/trunk/src/test/org/hibernate/test/annotations/id/BreakDance.java 2008-06-10
14:14:15 UTC (rev 14759)
+++
annotations/trunk/src/test/org/hibernate/test/annotations/id/BreakDance.java 2008-06-11
07:33:15 UTC (rev 14760)
@@ -1,27 +0,0 @@
-//$Id$
-package org.hibernate.test.annotations.id;
-
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.GeneratedValue;
-import javax.persistence.TableGenerator;
-import javax.persistence.GenerationType;
-
-/**
- * @author Emmanuel Bernard
- */
-@Entity
-public class BreakDance {
- @Id
- @GeneratedValue(generator = "memencoIdGen", strategy = GenerationType.TABLE)
- @TableGenerator(
- name = "memencoIdGen",
- table = "hi_id_key",
- pkColumnName = "id_key",
- valueColumnName = "next_hi",
- pkColumnValue = "issue",
- allocationSize = 1
- )
- public Integer id;
- public String name;
-}
Deleted: annotations/trunk/src/test/org/hibernate/test/annotations/id/Computer.java
===================================================================
--- annotations/trunk/src/test/org/hibernate/test/annotations/id/Computer.java 2008-06-10
14:14:15 UTC (rev 14759)
+++ annotations/trunk/src/test/org/hibernate/test/annotations/id/Computer.java 2008-06-11
07:33:15 UTC (rev 14760)
@@ -1,34 +0,0 @@
-//$Id$
-package org.hibernate.test.annotations.id;
-
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-
-/**
- * @author Emmanuel Bernard
- */
-@Entity()
-public class Computer {
- private Long id;
- private String serialNumber;
-
- @Id
- @GeneratedValue(strategy = GenerationType.TABLE)
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- public String getSerialNumber() {
- return serialNumber;
- }
-
- public void setSerialNumber(String serialNumber) {
- this.serialNumber = serialNumber;
- }
-}
Deleted: annotations/trunk/src/test/org/hibernate/test/annotations/id/Department.java
===================================================================
---
annotations/trunk/src/test/org/hibernate/test/annotations/id/Department.java 2008-06-10
14:14:15 UTC (rev 14759)
+++
annotations/trunk/src/test/org/hibernate/test/annotations/id/Department.java 2008-06-11
07:33:15 UTC (rev 14760)
@@ -1,32 +0,0 @@
-//$Id$
-package org.hibernate.test.annotations.id;
-
-import java.io.Serializable;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-
-/**
- * Sample of method generator
- *
- * @author Emmanuel Bernard
- */
-@Entity
-public class Department implements Serializable {
- private Long id;
-
- @Id
- @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_DEPT")
- @javax.persistence.SequenceGenerator(
- name = "SEQ_DEPT",
- sequenceName = "my_sequence"
- )
- public Long getId() {
- return id;
- }
-
- public void setId(Long long1) {
- id = long1;
- }
-}
Deleted: annotations/trunk/src/test/org/hibernate/test/annotations/id/Dog.java
===================================================================
--- annotations/trunk/src/test/org/hibernate/test/annotations/id/Dog.java 2008-06-10
14:14:15 UTC (rev 14759)
+++ annotations/trunk/src/test/org/hibernate/test/annotations/id/Dog.java 2008-06-11
07:33:15 UTC (rev 14760)
@@ -1,42 +0,0 @@
-//$Id$
-package org.hibernate.test.annotations.id;
-
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import javax.persistence.TableGenerator;
-
-/**
- * Share the generator table decribed by the GEN_TABLE GeneratedIdTable
- * using the Dog key as discriminator
- *
- * @author Emmanuel Bernard
- */
-@Entity
-@Table(name = "tbl_dog")
-@TableGenerator(name = "DogGen", table = "GENERATOR_TABLE",
pkColumnName = "pkey",
- valueColumnName = "hi", pkColumnValue = "Dog", allocationSize =
10)
-public class Dog {
- private Integer id;
- private String name;
-
- @Id
- @GeneratedValue(strategy = GenerationType.TABLE, generator = "DogGen")
- public Integer getId() {
- return id;
- }
-
- public void setId(Integer id) {
- this.id = id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-}
Deleted: annotations/trunk/src/test/org/hibernate/test/annotations/id/FirTree.java
===================================================================
--- annotations/trunk/src/test/org/hibernate/test/annotations/id/FirTree.java 2008-06-10
14:14:15 UTC (rev 14759)
+++ annotations/trunk/src/test/org/hibernate/test/annotations/id/FirTree.java 2008-06-11
07:33:15 UTC (rev 14760)
@@ -1,11 +0,0 @@
-//$Id$
-package org.hibernate.test.annotations.id;
-
-import javax.persistence.Entity;
-
-/**
- * @author Emmanuel Bernard
- */
-@Entity
-public class FirTree extends Tree {
-}
Deleted: annotations/trunk/src/test/org/hibernate/test/annotations/id/Footballer.java
===================================================================
---
annotations/trunk/src/test/org/hibernate/test/annotations/id/Footballer.java 2008-06-10
14:14:15 UTC (rev 14759)
+++
annotations/trunk/src/test/org/hibernate/test/annotations/id/Footballer.java 2008-06-11
07:33:15 UTC (rev 14760)
@@ -1,73 +0,0 @@
-//$Id$
-package org.hibernate.test.annotations.id;
-
-import javax.persistence.DiscriminatorColumn;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.IdClass;
-
-/**
- * @author Emmanuel Bernard
- */
-@Entity
-(a)IdClass(FootballerPk.class)
-@DiscriminatorColumn(name = "bibi")
-public class Footballer {
- private String firstname;
- private String lastname;
- private String club;
-
- public Footballer() {
- }
-
- public Footballer(String firstname, String lastname, String club) {
- this.firstname = firstname;
- this.lastname = lastname;
- this.club = club;
- }
-
- public boolean equals(Object o) {
- if ( this == o ) return true;
- if ( !( o instanceof Footballer ) ) return false;
-
- final Footballer footballer = (Footballer) o;
-
- if ( !firstname.equals( footballer.firstname ) ) return false;
- if ( !lastname.equals( footballer.lastname ) ) return false;
-
- return true;
- }
-
- public int hashCode() {
- int result;
- result = firstname.hashCode();
- result = 29 * result + lastname.hashCode();
- return result;
- }
-
- @Id
- public String getFirstname() {
- return firstname;
- }
-
- public void setFirstname(String firstname) {
- this.firstname = firstname;
- }
-
- @Id
- public String getLastname() {
- return lastname;
- }
-
- public void setLastname(String lastname) {
- this.lastname = lastname;
- }
-
- public String getClub() {
- return club;
- }
-
- public void setClub(String club) {
- this.club = club;
- }
-}
Deleted: annotations/trunk/src/test/org/hibernate/test/annotations/id/FootballerPk.java
===================================================================
---
annotations/trunk/src/test/org/hibernate/test/annotations/id/FootballerPk.java 2008-06-10
14:14:15 UTC (rev 14759)
+++
annotations/trunk/src/test/org/hibernate/test/annotations/id/FootballerPk.java 2008-06-11
07:33:15 UTC (rev 14760)
@@ -1,61 +0,0 @@
-//$Id$
-package org.hibernate.test.annotations.id;
-
-import java.io.Serializable;
-import javax.persistence.Column;
-import javax.persistence.Embeddable;
-
-/**
- * @author Emmanuel Bernard
- */
-@Embeddable
-public class FootballerPk implements Serializable {
- private String firstname;
- private String lastname;
-
- @Column(name = "fb_fname")
- public String getFirstname() {
- return firstname;
- }
-
- public String getLastname() {
- return lastname;
- }
-
- public void setFirstname(String firstname) {
- this.firstname = firstname;
- }
-
- public void setLastname(String lastname) {
- this.lastname = lastname;
- }
-
- public FootballerPk() {
- }
-
- public FootballerPk(String firstname, String lastname) {
- this.firstname = firstname;
- this.lastname = lastname;
-
- }
-
- public boolean equals(Object o) {
- if ( this == o ) return true;
- if ( !( o instanceof FootballerPk ) ) return false;
-
- final FootballerPk footballerPk = (FootballerPk) o;
-
- if ( !firstname.equals( footballerPk.firstname ) ) return false;
- if ( !lastname.equals( footballerPk.lastname ) ) return false;
-
- return true;
- }
-
- public int hashCode() {
- int result;
- result = firstname.hashCode();
- result = 29 * result + lastname.hashCode();
- return result;
- }
-
-}
Deleted: annotations/trunk/src/test/org/hibernate/test/annotations/id/Furniture.java
===================================================================
--- annotations/trunk/src/test/org/hibernate/test/annotations/id/Furniture.java 2008-06-10
14:14:15 UTC (rev 14759)
+++ annotations/trunk/src/test/org/hibernate/test/annotations/id/Furniture.java 2008-06-11
07:33:15 UTC (rev 14760)
@@ -1,33 +0,0 @@
-//$Id$
-package org.hibernate.test.annotations.id;
-
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-
-import org.hibernate.annotations.GenericGenerator;
-import org.hibernate.annotations.Parameter;
-
-/**
- * @author Emmanuel Bernard
- */
-@Entity
-public class Furniture {
- private Integer id;
-
- @Id
- @GeneratedValue(generator = "hibseq")
- @GenericGenerator(name = "hibseq", strategy = "seqhilo",
- parameters = {
- @Parameter(name = "max_lo", value = "5"),
- @Parameter(name = "sequence", value = "heybabyhey")
- }
- )
- public Integer getId() {
- return id;
- }
-
- public void setId(Integer id) {
- this.id = id;
- }
-}
Deleted: annotations/trunk/src/test/org/hibernate/test/annotations/id/GoalKeeper.java
===================================================================
---
annotations/trunk/src/test/org/hibernate/test/annotations/id/GoalKeeper.java 2008-06-10
14:14:15 UTC (rev 14759)
+++
annotations/trunk/src/test/org/hibernate/test/annotations/id/GoalKeeper.java 2008-06-11
07:33:15 UTC (rev 14760)
@@ -1,17 +0,0 @@
-//$Id$
-package org.hibernate.test.annotations.id;
-
-import javax.persistence.Entity;
-
-/**
- * @author Emmanuel Bernard
- */
-@Entity
-public class GoalKeeper extends Footballer {
- public GoalKeeper() {
- }
-
- public GoalKeeper(String firstname, String lastname, String club) {
- super( firstname, lastname, club );
- }
-}
Deleted: annotations/trunk/src/test/org/hibernate/test/annotations/id/Home.java
===================================================================
--- annotations/trunk/src/test/org/hibernate/test/annotations/id/Home.java 2008-06-10
14:14:15 UTC (rev 14759)
+++ annotations/trunk/src/test/org/hibernate/test/annotations/id/Home.java 2008-06-11
07:33:15 UTC (rev 14760)
@@ -1,26 +0,0 @@
-//$Id$
-package org.hibernate.test.annotations.id;
-
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-
-/**
- * Default sequence generation usage
- *
- * @author Emmanuel Bernard
- */
-@Entity
-public class Home {
- private Long id;
-
- @Id
- @GeneratedValue
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-}
Modified: annotations/trunk/src/test/org/hibernate/test/annotations/id/IdClassTest.java
===================================================================
---
annotations/trunk/src/test/org/hibernate/test/annotations/id/IdClassTest.java 2008-06-10
14:14:15 UTC (rev 14759)
+++
annotations/trunk/src/test/org/hibernate/test/annotations/id/IdClassTest.java 2008-06-11
07:33:15 UTC (rev 14760)
@@ -4,6 +4,8 @@
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.test.annotations.TestCase;
+import org.hibernate.test.annotations.id.entities.Location;
+import org.hibernate.test.annotations.id.entities.Tower;
/**
* @author Emmanuel Bernard
Modified: annotations/trunk/src/test/org/hibernate/test/annotations/id/IdTest.java
===================================================================
--- annotations/trunk/src/test/org/hibernate/test/annotations/id/IdTest.java 2008-06-10
14:14:15 UTC (rev 14759)
+++ annotations/trunk/src/test/org/hibernate/test/annotations/id/IdTest.java 2008-06-11
07:33:15 UTC (rev 14760)
@@ -3,53 +3,79 @@
import org.hibernate.Session;
import org.hibernate.Transaction;
+import org.hibernate.cfg.AnnotationConfiguration;
+import org.hibernate.dialect.SQLServerDialect;
import org.hibernate.mapping.Column;
import org.hibernate.test.annotations.TestCase;
+import org.hibernate.test.annotations.id.entities.Ball;
+import org.hibernate.test.annotations.id.entities.BreakDance;
+import org.hibernate.test.annotations.id.entities.Bunny;
+import org.hibernate.test.annotations.id.entities.Computer;
+import org.hibernate.test.annotations.id.entities.Department;
+import org.hibernate.test.annotations.id.entities.Dog;
+import org.hibernate.test.annotations.id.entities.FirTree;
+import org.hibernate.test.annotations.id.entities.Footballer;
+import org.hibernate.test.annotations.id.entities.FootballerPk;
+import org.hibernate.test.annotations.id.entities.Furniture;
+import org.hibernate.test.annotations.id.entities.GoalKeeper;
+import org.hibernate.test.annotations.id.entities.Home;
+import org.hibernate.test.annotations.id.entities.Monkey;
+import org.hibernate.test.annotations.id.entities.Phone;
+import org.hibernate.test.annotations.id.entities.PointyTooth;
+import org.hibernate.test.annotations.id.entities.Shoe;
+import org.hibernate.test.annotations.id.entities.SoundSystem;
+import org.hibernate.test.annotations.id.entities.Store;
+import org.hibernate.test.annotations.id.entities.Tree;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* @author Emmanuel Bernard
*/
+@SuppressWarnings("unchecked")
public class IdTest extends TestCase {
- //FIXME split Sequence and Id tests to explicit the run failure on Oracle etc
+ // FIXME split Sequence and Id tests to explicit the run failure on Oracle etc
+ private Logger log = LoggerFactory.getLogger(IdTest.class);
+
public IdTest(String x) {
- super( x );
+ super(x);
}
public void testGenericGenerator() throws Exception {
Session s = openSession();
Transaction tx = s.beginTransaction();
SoundSystem system = new SoundSystem();
- system.setBrand( "Genelec" );
- system.setModel( "T234" );
+ system.setBrand("Genelec");
+ system.setModel("T234");
Furniture fur = new Furniture();
- s.persist( system );
- s.persist( fur );
+ s.persist(system);
+ s.persist(fur);
tx.commit();
s.close();
s = openSession();
tx = s.beginTransaction();
- system = (SoundSystem) s.get( SoundSystem.class, system.getId() );
- fur = (Furniture) s.get( Furniture.class, fur.getId() );
- assertNotNull( system );
- assertNotNull( fur );
- s.delete( system );
- s.delete( fur );
+ system = (SoundSystem) s.get(SoundSystem.class, system.getId());
+ fur = (Furniture) s.get(Furniture.class, fur.getId());
+ assertNotNull(system);
+ assertNotNull(fur);
+ s.delete(system);
+ s.delete(fur);
tx.commit();
s.close();
}
/*
- * Ensures that GenericGenerator annotations wrapped inside a GenericGenerators holder
are
- * bound correctly
+ * Ensures that GenericGenerator annotations wrapped inside a
+ * GenericGenerators holder are bound correctly
*/
public void testGenericGenerators() throws Exception {
Session s = openSession();
Transaction tx = s.beginTransaction();
Monkey monkey = new Monkey();
- s.persist( monkey );
+ s.persist(monkey);
s.flush();
assertNotNull(monkey.getId());
tx.rollback();
@@ -63,20 +89,21 @@
Ball b = new Ball();
Dog d = new Dog();
Computer c = new Computer();
- s.persist( b );
- s.persist( d );
- s.persist( c );
+ s.persist(b);
+ s.persist(d);
+ s.persist(c);
tx.commit();
s.close();
- assertEquals( "table id not generated", new Integer( 1 ), b.getId() );
- assertEquals( "generator should not be shared", new Integer( 1 ), d.getId()
);
- assertEquals( "default value should work", new Long( 1 ), c.getId() );
+ assertEquals("table id not generated", new Integer(1), b.getId());
+ assertEquals("generator should not be shared", new Integer(1), d
+ .getId());
+ assertEquals("default value should work", new Long(1), c.getId());
s = openSession();
tx = s.beginTransaction();
- s.delete( s.get( Ball.class, new Integer( 1 ) ) );
- s.delete( s.get( Dog.class, new Integer( 1 ) ) );
- s.delete( s.get( Computer.class, new Long( 1 ) ) );
+ s.delete(s.get(Ball.class, new Integer(1)));
+ s.delete(s.get(Dog.class, new Integer(1)));
+ s.delete(s.get(Computer.class, new Long(1)));
tx.commit();
s.close();
}
@@ -85,14 +112,14 @@
Session s = openSession();
Transaction tx = s.beginTransaction();
Shoe b = new Shoe();
- s.persist( b );
+ s.persist(b);
tx.commit();
s.close();
- assertNotNull( b.getId() );
+ assertNotNull(b.getId());
s = openSession();
tx = s.beginTransaction();
- s.delete( s.get( Shoe.class, b.getId() ) );
+ s.delete(s.get(Shoe.class, b.getId()));
tx.commit();
s.close();
}
@@ -101,14 +128,14 @@
Session s = openSession();
Transaction tx = s.beginTransaction();
Store b = new Store();
- s.persist( b );
+ s.persist(b);
tx.commit();
s.close();
- assertNotNull( b.getId() );
+ assertNotNull(b.getId());
s = openSession();
tx = s.beginTransaction();
- s.delete( s.get( Store.class, b.getId() ) );
+ s.delete(s.get(Store.class, b.getId()));
tx.commit();
s.close();
}
@@ -117,14 +144,14 @@
Session s = openSession();
Transaction tx = s.beginTransaction();
Department b = new Department();
- s.persist( b );
+ s.persist(b);
tx.commit();
s.close();
- assertNotNull( b.getId() );
+ assertNotNull(b.getId());
s = openSession();
tx = s.beginTransaction();
- s.delete( s.get( Department.class, b.getId() ) );
+ s.delete(s.get(Department.class, b.getId()));
tx.commit();
s.close();
}
@@ -135,16 +162,16 @@
s = openSession();
tx = s.beginTransaction();
Home h = new Home();
- s.persist( h );
+ s.persist(h);
tx.commit();
s.close();
- assertNotNull( h.getId() );
+ assertNotNull(h.getId());
s = openSession();
tx = s.beginTransaction();
- Home reloadedHome = (Home) s.get( Home.class, h.getId() );
- assertEquals( h.getId(), reloadedHome.getId() );
- s.delete( reloadedHome );
+ Home reloadedHome = (Home) s.get(Home.class, h.getId());
+ assertEquals(h.getId(), reloadedHome.getId());
+ s.delete(reloadedHome);
tx.commit();
s.close();
}
@@ -155,16 +182,16 @@
s = openSession();
tx = s.beginTransaction();
Home h = new Home();
- s.persist( h );
+ s.persist(h);
tx.commit();
s.close();
- assertNotNull( h.getId() );
+ assertNotNull(h.getId());
s = openSession();
tx = s.beginTransaction();
- Home reloadedHome = (Home) s.get( Home.class, h.getId() );
- assertEquals( h.getId(), reloadedHome.getId() );
- s.delete( reloadedHome );
+ Home reloadedHome = (Home) s.get(Home.class, h.getId());
+ assertEquals(h.getId(), reloadedHome.getId());
+ s.delete(reloadedHome);
tx.commit();
s.close();
}
@@ -175,13 +202,13 @@
s = openSession();
tx = s.beginTransaction();
FirTree chrismasTree = new FirTree();
- s.persist( chrismasTree );
+ s.persist(chrismasTree);
tx.commit();
s.clear();
tx = s.beginTransaction();
- chrismasTree = (FirTree) s.get( FirTree.class, chrismasTree.getId() );
- assertNotNull( chrismasTree );
- s.delete( chrismasTree );
+ chrismasTree = (FirTree) s.get(FirTree.class, chrismasTree.getId());
+ assertNotNull(chrismasTree);
+ s.delete(chrismasTree);
tx.commit();
s.close();
}
@@ -191,54 +218,55 @@
Transaction tx;
s = openSession();
tx = s.beginTransaction();
- Footballer fb = new Footballer( "David", "Beckam",
"Arsenal" );
- GoalKeeper keeper = new GoalKeeper( "Fabien", "Bartez",
"OM" );
- s.persist( fb );
- s.persist( keeper );
+ Footballer fb = new Footballer("David", "Beckam",
"Arsenal");
+ GoalKeeper keeper = new GoalKeeper("Fabien", "Bartez",
"OM");
+ s.persist(fb);
+ s.persist(keeper);
tx.commit();
s.clear();
- //lookup by id
+ // lookup by id
tx = s.beginTransaction();
- FootballerPk fpk = new FootballerPk( "David", "Beckam" );
- fb = (Footballer) s.get( Footballer.class, fpk );
- FootballerPk fpk2 = new FootballerPk( "Fabien", "Bartez" );
- keeper = (GoalKeeper) s.get( GoalKeeper.class, fpk2 );
- assertNotNull( fb );
- assertNotNull( keeper );
- assertEquals( "Beckam", fb.getLastname() );
- assertEquals( "Arsenal", fb.getClub() );
- assertEquals( 1, s.createQuery( "from Footballer f where f.firstname =
'David'" ).list().size() );
+ FootballerPk fpk = new FootballerPk("David", "Beckam");
+ fb = (Footballer) s.get(Footballer.class, fpk);
+ FootballerPk fpk2 = new FootballerPk("Fabien", "Bartez");
+ keeper = (GoalKeeper) s.get(GoalKeeper.class, fpk2);
+ assertNotNull(fb);
+ assertNotNull(keeper);
+ assertEquals("Beckam", fb.getLastname());
+ assertEquals("Arsenal", fb.getClub());
+ assertEquals(1, s.createQuery(
+ "from Footballer f where f.firstname = 'David'").list().size());
tx.commit();
- //reattach by merge
+ // reattach by merge
tx = s.beginTransaction();
- fb.setClub( "Bimbo FC" );
- s.merge( fb );
+ fb.setClub("Bimbo FC");
+ s.merge(fb);
tx.commit();
- //reattach by saveOrUpdate
+ // reattach by saveOrUpdate
tx = s.beginTransaction();
- fb.setClub( "Bimbo FC SA" );
- s.saveOrUpdate( fb );
+ fb.setClub("Bimbo FC SA");
+ s.saveOrUpdate(fb);
tx.commit();
- //clean up
+ // clean up
s.clear();
tx = s.beginTransaction();
- fpk = new FootballerPk( "David", "Beckam" );
- fb = (Footballer) s.get( Footballer.class, fpk );
- assertEquals( "Bimbo FC SA", fb.getClub() );
- s.delete( fb );
- s.delete( keeper );
+ fpk = new FootballerPk("David", "Beckam");
+ fb = (Footballer) s.get(Footballer.class, fpk);
+ assertEquals("Bimbo FC SA", fb.getClub());
+ s.delete(fb);
+ s.delete(keeper);
tx.commit();
s.close();
}
public void testColumnDefinition() {
- Column idCol = (Column) getCfg().getClassMapping( Ball.class.getName()
).getIdentifierProperty().getValue()
- .getColumnIterator().next();
- assertEquals( "ball_id", idCol.getName() );
+ Column idCol = (Column) getCfg().getClassMapping(Ball.class.getName())
+ .getIdentifierProperty().getValue().getColumnIterator().next();
+ assertEquals("ball_id", idCol.getName());
}
public void testLowAllocationSize() throws Exception {
@@ -248,57 +276,77 @@
tx = s.beginTransaction();
int size = 4;
BreakDance[] bds = new BreakDance[size];
- for (int i = 0 ; i < size ; i++) {
+ for (int i = 0; i < size; i++) {
bds[i] = new BreakDance();
- s.persist( bds[i] );
+ s.persist(bds[i]);
}
s.flush();
- for (int i = 0 ; i < size ; i++) {
- assertEquals(i + 1, bds[i].id.intValue() );
+ for (int i = 0; i < size; i++) {
+ assertEquals(i + 1, bds[i].id.intValue());
}
tx.rollback();
s.close();
}
/**
+ * See JIRA bug ANN-748.
+ */
+ public void testBlownPrecision() throws Exception {
+
+ try {
+ AnnotationConfiguration config = new AnnotationConfiguration();
+ config.addAnnotatedClass(Bunny.class);
+ config.addAnnotatedClass(PointyTooth.class);
+ config.buildSessionFactory();
+ String[] schema = config
+ .generateSchemaCreationScript(new SQLServerDialect());
+ for (String s : schema) {
+ log.debug(s);
+ }
+ String expectedMappingTableSql = "create table PointyTooth (id numeric(128,0) not
null, " +
+ "bunny_id numeric(128,0) null, primary key (id))";
+ assertEquals("Wrong SQL", expectedMappingTableSql, schema[1]);
+ } catch (Exception e) {
+ fail(e.getMessage());
+ }
+
+
+// Session s = openSession();
+// Transaction tx = s.beginTransaction();
+// Bunny bunny = new Bunny();
+// PointyTooth tooth = new PointyTooth();
+// Set<PointyTooth> teeth = new HashSet<PointyTooth>();
+// teeth.add(tooth);
+// bunny.setTeeth(teeth);
+// tooth.setBunny(bunny);
+// s.persist(bunny);
+// s.flush();
+// tx.rollback();
+// s.close();
+ }
+
+ /**
* @see org.hibernate.test.annotations.TestCase#getMappings()
*/
protected Class[] getMappings() {
- return new Class[]{
- Ball.class,
- Shoe.class,
- Store.class,
- Department.class,
- Dog.class,
- Computer.class,
- Home.class,
- Phone.class,
- Tree.class,
- FirTree.class,
- Footballer.class,
- SoundSystem.class,
- Furniture.class,
- GoalKeeper.class,
- BreakDance.class,
- Monkey.class
- };
+ return new Class[] { Ball.class, Shoe.class, Store.class,
+ Department.class, Dog.class, Computer.class, Home.class,
+ Phone.class, Tree.class, FirTree.class, Footballer.class,
+ SoundSystem.class, Furniture.class, GoalKeeper.class,
+ BreakDance.class, Monkey.class, Bunny.class, PointyTooth.class };
}
/**
* @see org.hibernate.test.annotations.TestCase#getAnnotatedPackages()
*/
protected String[] getAnnotatedPackages() {
- return new String[]{
- "org.hibernate.test.annotations",
- "org.hibernate.test.annotations.id"
- };
+ return new String[] { "org.hibernate.test.annotations",
+ "org.hibernate.test.annotations.id" };
}
@Override
protected String[] getXmlFiles() {
- return new String[] {
- "org/hibernate/test/annotations/orm.xml"
- };
+ return new String[] { "org/hibernate/test/annotations/orm.xml" };
}
}
Deleted: annotations/trunk/src/test/org/hibernate/test/annotations/id/Location.java
===================================================================
--- annotations/trunk/src/test/org/hibernate/test/annotations/id/Location.java 2008-06-10
14:14:15 UTC (rev 14759)
+++ annotations/trunk/src/test/org/hibernate/test/annotations/id/Location.java 2008-06-11
07:33:15 UTC (rev 14760)
@@ -1,34 +0,0 @@
-//$Id$
-package org.hibernate.test.annotations.id;
-
-import java.io.Serializable;
-
-/**
- * @author Emmanuel Bernard
- */
-public class Location implements Serializable {
- public double longitude;
- public double latitude;
-
- public boolean equals(Object o) {
- if ( this == o ) return true;
- if ( o == null || getClass() != o.getClass() ) return false;
-
- final Location location = (Location) o;
-
- if ( Double.compare( location.latitude, latitude ) != 0 ) return false;
- if ( Double.compare( location.longitude, longitude ) != 0 ) return false;
-
- return true;
- }
-
- public int hashCode() {
- int result;
- long temp;
- temp = longitude != +0.0d ? Double.doubleToLongBits( longitude ) : 0L;
- result = (int) ( temp ^ ( temp >>> 32 ) );
- temp = latitude != +0.0d ? Double.doubleToLongBits( latitude ) : 0L;
- result = 29 * result + (int) ( temp ^ ( temp >>> 32 ) );
- return result;
- }
-}
Deleted:
annotations/trunk/src/test/org/hibernate/test/annotations/id/MilitaryBuilding.java
===================================================================
---
annotations/trunk/src/test/org/hibernate/test/annotations/id/MilitaryBuilding.java 2008-06-10
14:14:15 UTC (rev 14759)
+++
annotations/trunk/src/test/org/hibernate/test/annotations/id/MilitaryBuilding.java 2008-06-11
07:33:15 UTC (rev 14760)
@@ -1,18 +0,0 @@
-//$Id$
-package org.hibernate.test.annotations.id;
-
-import javax.persistence.Id;
-import javax.persistence.IdClass;
-import javax.persistence.MappedSuperclass;
-
-/**
- * @author Emmanuel Bernard
- */
-@MappedSuperclass
-(a)IdClass(Location.class)
-public class MilitaryBuilding {
- @Id
- public double longitude;
- @Id
- public double latitude;
-}
Deleted: annotations/trunk/src/test/org/hibernate/test/annotations/id/Monkey.java
===================================================================
--- annotations/trunk/src/test/org/hibernate/test/annotations/id/Monkey.java 2008-06-10
14:14:15 UTC (rev 14759)
+++ annotations/trunk/src/test/org/hibernate/test/annotations/id/Monkey.java 2008-06-11
07:33:15 UTC (rev 14760)
@@ -1,24 +0,0 @@
-//$
-package org.hibernate.test.annotations.id;
-
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-
-/**
- * @author Paul Cowan
- */
-@Entity
-public class Monkey {
- private String id;
-
- @Id
- @GeneratedValue(generator = "system-uuid-2")
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-}
Deleted: annotations/trunk/src/test/org/hibernate/test/annotations/id/Phone.java
===================================================================
--- annotations/trunk/src/test/org/hibernate/test/annotations/id/Phone.java 2008-06-10
14:14:15 UTC (rev 14759)
+++ annotations/trunk/src/test/org/hibernate/test/annotations/id/Phone.java 2008-06-11
07:33:15 UTC (rev 14760)
@@ -1,29 +0,0 @@
-//$Id$
-package org.hibernate.test.annotations.id;
-
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-
-/**
- * @author Emmanuel Bernard
- */
-@Entity()
-public class Phone {
- private Integer id;
-
- @Id
- @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "Phone_Gen")
- @javax.persistence.SequenceGenerator(
- name = "Phone_Gen",
- sequenceName = "phone_seq"
- )
- public Integer getId() {
- return id;
- }
-
- public void setId(Integer id) {
- this.id = id;
- }
-}
Deleted: annotations/trunk/src/test/org/hibernate/test/annotations/id/Shoe.java
===================================================================
--- annotations/trunk/src/test/org/hibernate/test/annotations/id/Shoe.java 2008-06-10
14:14:15 UTC (rev 14759)
+++ annotations/trunk/src/test/org/hibernate/test/annotations/id/Shoe.java 2008-06-11
07:33:15 UTC (rev 14760)
@@ -1,28 +0,0 @@
-//$Id$
-package org.hibernate.test.annotations.id;
-
-import java.io.Serializable;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-
-/**
- * sample of Sequance generator
- *
- * @author Emmanuel Bernard
- */
-@Entity
-public class Shoe implements Serializable {
- private Long id;
-
- @Id
- @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_GEN")
- public Long getId() {
- return id;
- }
-
- public void setId(Long long1) {
- id = long1;
- }
-}
Deleted: annotations/trunk/src/test/org/hibernate/test/annotations/id/SoundSystem.java
===================================================================
---
annotations/trunk/src/test/org/hibernate/test/annotations/id/SoundSystem.java 2008-06-10
14:14:15 UTC (rev 14759)
+++
annotations/trunk/src/test/org/hibernate/test/annotations/id/SoundSystem.java 2008-06-11
07:33:15 UTC (rev 14760)
@@ -1,42 +0,0 @@
-//$Id$
-package org.hibernate.test.annotations.id;
-
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-
-/**
- * @author Emmanuel Bernard
- */
-@Entity
-public class SoundSystem {
- private String id;
- private String brand;
- private String model;
-
- @Id
- @GeneratedValue(generator = "system-uuid")
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getBrand() {
- return brand;
- }
-
- public void setBrand(String brand) {
- this.brand = brand;
- }
-
- public String getModel() {
- return model;
- }
-
- public void setModel(String model) {
- this.model = model;
- }
-}
Deleted: annotations/trunk/src/test/org/hibernate/test/annotations/id/Store.java
===================================================================
--- annotations/trunk/src/test/org/hibernate/test/annotations/id/Store.java 2008-06-10
14:14:15 UTC (rev 14759)
+++ annotations/trunk/src/test/org/hibernate/test/annotations/id/Store.java 2008-06-11
07:33:15 UTC (rev 14760)
@@ -1,32 +0,0 @@
-//$Id$
-package org.hibernate.test.annotations.id;
-
-import java.io.Serializable;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-
-/**
- * Sample of class generator
- *
- * @author Emmanuel Bernard
- */
-@Entity
-(a)javax.persistence.SequenceGenerator(
- name = "SEQ_STORE",
- sequenceName = "my_sequence"
-)
-public class Store implements Serializable {
- private Long id;
-
- @Id
- @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_STORE")
- public Long getId() {
- return id;
- }
-
- public void setId(Long long1) {
- id = long1;
- }
-}
Deleted: annotations/trunk/src/test/org/hibernate/test/annotations/id/Tower.java
===================================================================
--- annotations/trunk/src/test/org/hibernate/test/annotations/id/Tower.java 2008-06-10
14:14:15 UTC (rev 14759)
+++ annotations/trunk/src/test/org/hibernate/test/annotations/id/Tower.java 2008-06-11
07:33:15 UTC (rev 14760)
@@ -1,14 +0,0 @@
-//$Id$
-package org.hibernate.test.annotations.id;
-
-import javax.persistence.AttributeOverride;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-
-/**
- * @author Emmanuel Bernard
- */
-@Entity
-@AttributeOverride(name = "longitude", column = @Column(name =
"fld_longitude"))
-public class Tower extends MilitaryBuilding {
-}
Deleted: annotations/trunk/src/test/org/hibernate/test/annotations/id/Tree.java
===================================================================
--- annotations/trunk/src/test/org/hibernate/test/annotations/id/Tree.java 2008-06-10
14:14:15 UTC (rev 14759)
+++ annotations/trunk/src/test/org/hibernate/test/annotations/id/Tree.java 2008-06-11
07:33:15 UTC (rev 14760)
@@ -1,24 +0,0 @@
-//$Id$
-package org.hibernate.test.annotations.id;
-
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.MappedSuperclass;
-
-/**
- * @author Emmanuel Bernard
- */
-@MappedSuperclass
-public class Tree {
- private Integer id;
-
- @Id
- @GeneratedValue
- public Integer getId() {
- return id;
- }
-
- public void setId(Integer id) {
- this.id = id;
- }
-}
Added: annotations/trunk/src/test/org/hibernate/test/annotations/id/UUIDGenerator.java
===================================================================
--- annotations/trunk/src/test/org/hibernate/test/annotations/id/UUIDGenerator.java
(rev 0)
+++
annotations/trunk/src/test/org/hibernate/test/annotations/id/UUIDGenerator.java 2008-06-11
07:33:15 UTC (rev 14760)
@@ -0,0 +1,34 @@
+package org.hibernate.test.annotations.id;
+
+import java.io.Serializable;
+import java.math.BigInteger;
+import java.util.UUID;
+
+import org.hibernate.HibernateException;
+import org.hibernate.engine.SessionImplementor;
+import org.hibernate.id.IdentifierGenerator;
+
+/**
+ * Unlike Hibernate's UUID generator. This avoids
+ * meaningless synchronization and has less
+ * than a chance of an asteroid hitting you on the head
+ * even after trillions of rows are inserted. I know
+ * this to be true because it says so in Wikipedia(haha).
+ *
http://en.wikipedia.org/wiki/UUID#Random_UUID_probability_of_duplicates
+ *
+ */
+public class UUIDGenerator implements IdentifierGenerator {
+
+ public Serializable generate(SessionImplementor arg0, Object arg1) throws
HibernateException {
+ UUID uuid = UUID.randomUUID();
+ String sud = uuid.toString();
+ System.out.println("uuid="+uuid);
+ sud = sud.replaceAll("-", "");
+
+ BigInteger integer = new BigInteger(sud,16);
+
+ System.out.println("bi ="+integer.toString() );
+ return integer;
+ }
+
+}
Property changes on:
annotations/trunk/src/test/org/hibernate/test/annotations/id/UUIDGenerator.java
___________________________________________________________________
Name: svn:keywords
+ Id
Copied: annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Ball.java
(from rev 14758, annotations/trunk/src/test/org/hibernate/test/annotations/id/Ball.java)
===================================================================
--- annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Ball.java
(rev 0)
+++
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Ball.java 2008-06-11
07:33:15 UTC (rev 14760)
@@ -0,0 +1,35 @@
+//$Id$
+package org.hibernate.test.annotations.id.entities;
+
+import java.io.Serializable;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.TableGenerator;
+
+/**
+ * Sample of table generator
+ *
+ * @author Emmanuel Bernard
+ */
+@TableGenerator(name = "EMP_GEN", table = "GENERATOR_TABLE",
pkColumnName = "pkey",
+ valueColumnName = "hi", pkColumnValue = "Ball", allocationSize =
10)
+@Entity
+@SuppressWarnings("serial")
+public class Ball implements Serializable {
+ private Integer id;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.TABLE, generator = "EMP_GEN")
+ @Column(name = "ball_id")
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+}
Copied:
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/BreakDance.java
(from rev 14758,
annotations/trunk/src/test/org/hibernate/test/annotations/id/BreakDance.java)
===================================================================
--- annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/BreakDance.java
(rev 0)
+++
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/BreakDance.java 2008-06-11
07:33:15 UTC (rev 14760)
@@ -0,0 +1,27 @@
+//$Id$
+package org.hibernate.test.annotations.id.entities;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.GeneratedValue;
+import javax.persistence.TableGenerator;
+import javax.persistence.GenerationType;
+
+/**
+ * @author Emmanuel Bernard
+ */
+@Entity
+public class BreakDance {
+ @Id
+ @GeneratedValue(generator = "memencoIdGen", strategy = GenerationType.TABLE)
+ @TableGenerator(
+ name = "memencoIdGen",
+ table = "hi_id_key",
+ pkColumnName = "id_key",
+ valueColumnName = "next_hi",
+ pkColumnValue = "issue",
+ allocationSize = 1
+ )
+ public Integer id;
+ public String name;
+}
Added: annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Bunny.java
===================================================================
--- annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Bunny.java
(rev 0)
+++
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Bunny.java 2008-06-11
07:33:15 UTC (rev 14760)
@@ -0,0 +1,39 @@
+//$Id$
+package org.hibernate.test.annotations.id.entities;
+
+import java.io.Serializable;
+import java.math.BigInteger;
+import java.util.Set;
+
+import javax.persistence.Column;
+import javax.persistence.CascadeType;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.OneToMany;
+
+import org.hibernate.annotations.GenericGenerator;
+
+/**
+ * Blown precision on related entity when @JoinColumn is used.
+ *
+ * @see ANN-748
+ * @author Andrew C. Oliver andyspam(a)osintegrators.com
+ */
+@Entity
+@SuppressWarnings("serial")
+public class Bunny implements Serializable {
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY, generator = "java5_uuid")
+ @GenericGenerator(name = "java5_uuid", strategy =
"org.hibernate.test.annotations.id.UUIDGenerator")
+ @Column(name = "id", precision = 128, scale = 0)
+ private BigInteger id;
+
+ @OneToMany(mappedBy = "bunny", cascade = { CascadeType.PERSIST })
+ Set<PointyTooth> teeth;
+
+ public void setTeeth(Set<PointyTooth> teeth) {
+ this.teeth = teeth;
+ }
+}
Property changes on:
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Bunny.java
___________________________________________________________________
Name: svn:keywords
+ Id
Copied:
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Computer.java (from
rev 14758, annotations/trunk/src/test/org/hibernate/test/annotations/id/Computer.java)
===================================================================
--- annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Computer.java
(rev 0)
+++
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Computer.java 2008-06-11
07:33:15 UTC (rev 14760)
@@ -0,0 +1,34 @@
+//$Id$
+package org.hibernate.test.annotations.id.entities;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+
+/**
+ * @author Emmanuel Bernard
+ */
+@Entity()
+public class Computer {
+ private Long id;
+ private String serialNumber;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.TABLE)
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getSerialNumber() {
+ return serialNumber;
+ }
+
+ public void setSerialNumber(String serialNumber) {
+ this.serialNumber = serialNumber;
+ }
+}
Copied:
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Department.java
(from rev 14758,
annotations/trunk/src/test/org/hibernate/test/annotations/id/Department.java)
===================================================================
--- annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Department.java
(rev 0)
+++
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Department.java 2008-06-11
07:33:15 UTC (rev 14760)
@@ -0,0 +1,33 @@
+//$Id$
+package org.hibernate.test.annotations.id.entities;
+
+import java.io.Serializable;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+
+/**
+ * Sample of method generator
+ *
+ * @author Emmanuel Bernard
+ */
+@Entity
+@SuppressWarnings("serial")
+public class Department implements Serializable {
+ private Long id;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_DEPT")
+ @javax.persistence.SequenceGenerator(
+ name = "SEQ_DEPT",
+ sequenceName = "my_sequence"
+ )
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long long1) {
+ id = long1;
+ }
+}
Copied: annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Dog.java
(from rev 14758, annotations/trunk/src/test/org/hibernate/test/annotations/id/Dog.java)
===================================================================
--- annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Dog.java
(rev 0)
+++
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Dog.java 2008-06-11
07:33:15 UTC (rev 14760)
@@ -0,0 +1,42 @@
+//$Id$
+package org.hibernate.test.annotations.id.entities;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.TableGenerator;
+
+/**
+ * Share the generator table decribed by the GEN_TABLE GeneratedIdTable
+ * using the Dog key as discriminator
+ *
+ * @author Emmanuel Bernard
+ */
+@Entity
+@Table(name = "tbl_dog")
+@TableGenerator(name = "DogGen", table = "GENERATOR_TABLE",
pkColumnName = "pkey",
+ valueColumnName = "hi", pkColumnValue = "Dog", allocationSize =
10)
+public class Dog {
+ private Integer id;
+ private String name;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.TABLE, generator = "DogGen")
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
Copied: annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/FirTree.java
(from rev 14758,
annotations/trunk/src/test/org/hibernate/test/annotations/id/FirTree.java)
===================================================================
--- annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/FirTree.java
(rev 0)
+++
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/FirTree.java 2008-06-11
07:33:15 UTC (rev 14760)
@@ -0,0 +1,11 @@
+//$Id$
+package org.hibernate.test.annotations.id.entities;
+
+import javax.persistence.Entity;
+
+/**
+ * @author Emmanuel Bernard
+ */
+@Entity
+public class FirTree extends Tree {
+}
Copied:
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Footballer.java
(from rev 14758,
annotations/trunk/src/test/org/hibernate/test/annotations/id/Footballer.java)
===================================================================
--- annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Footballer.java
(rev 0)
+++
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Footballer.java 2008-06-11
07:33:15 UTC (rev 14760)
@@ -0,0 +1,73 @@
+//$Id$
+package org.hibernate.test.annotations.id.entities;
+
+import javax.persistence.DiscriminatorColumn;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.IdClass;
+
+/**
+ * @author Emmanuel Bernard
+ */
+@Entity
+(a)IdClass(FootballerPk.class)
+@DiscriminatorColumn(name = "bibi")
+public class Footballer {
+ private String firstname;
+ private String lastname;
+ private String club;
+
+ public Footballer() {
+ }
+
+ public Footballer(String firstname, String lastname, String club) {
+ this.firstname = firstname;
+ this.lastname = lastname;
+ this.club = club;
+ }
+
+ public boolean equals(Object o) {
+ if ( this == o ) return true;
+ if ( !( o instanceof Footballer ) ) return false;
+
+ final Footballer footballer = (Footballer) o;
+
+ if ( !firstname.equals( footballer.firstname ) ) return false;
+ if ( !lastname.equals( footballer.lastname ) ) return false;
+
+ return true;
+ }
+
+ public int hashCode() {
+ int result;
+ result = firstname.hashCode();
+ result = 29 * result + lastname.hashCode();
+ return result;
+ }
+
+ @Id
+ public String getFirstname() {
+ return firstname;
+ }
+
+ public void setFirstname(String firstname) {
+ this.firstname = firstname;
+ }
+
+ @Id
+ public String getLastname() {
+ return lastname;
+ }
+
+ public void setLastname(String lastname) {
+ this.lastname = lastname;
+ }
+
+ public String getClub() {
+ return club;
+ }
+
+ public void setClub(String club) {
+ this.club = club;
+ }
+}
Copied:
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/FootballerPk.java
(from rev 14758,
annotations/trunk/src/test/org/hibernate/test/annotations/id/FootballerPk.java)
===================================================================
---
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/FootballerPk.java
(rev 0)
+++
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/FootballerPk.java 2008-06-11
07:33:15 UTC (rev 14760)
@@ -0,0 +1,62 @@
+//$Id$
+package org.hibernate.test.annotations.id.entities;
+
+import java.io.Serializable;
+import javax.persistence.Column;
+import javax.persistence.Embeddable;
+
+/**
+ * @author Emmanuel Bernard
+ */
+@Embeddable
+@SuppressWarnings("serial")
+public class FootballerPk implements Serializable {
+ private String firstname;
+ private String lastname;
+
+ @Column(name = "fb_fname")
+ public String getFirstname() {
+ return firstname;
+ }
+
+ public String getLastname() {
+ return lastname;
+ }
+
+ public void setFirstname(String firstname) {
+ this.firstname = firstname;
+ }
+
+ public void setLastname(String lastname) {
+ this.lastname = lastname;
+ }
+
+ public FootballerPk() {
+ }
+
+ public FootballerPk(String firstname, String lastname) {
+ this.firstname = firstname;
+ this.lastname = lastname;
+
+ }
+
+ public boolean equals(Object o) {
+ if ( this == o ) return true;
+ if ( !( o instanceof FootballerPk ) ) return false;
+
+ final FootballerPk footballerPk = (FootballerPk) o;
+
+ if ( !firstname.equals( footballerPk.firstname ) ) return false;
+ if ( !lastname.equals( footballerPk.lastname ) ) return false;
+
+ return true;
+ }
+
+ public int hashCode() {
+ int result;
+ result = firstname.hashCode();
+ result = 29 * result + lastname.hashCode();
+ return result;
+ }
+
+}
Copied:
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Furniture.java (from
rev 14758, annotations/trunk/src/test/org/hibernate/test/annotations/id/Furniture.java)
===================================================================
--- annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Furniture.java
(rev 0)
+++
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Furniture.java 2008-06-11
07:33:15 UTC (rev 14760)
@@ -0,0 +1,33 @@
+//$Id$
+package org.hibernate.test.annotations.id.entities;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+
+import org.hibernate.annotations.GenericGenerator;
+import org.hibernate.annotations.Parameter;
+
+/**
+ * @author Emmanuel Bernard
+ */
+@Entity
+public class Furniture {
+ private Integer id;
+
+ @Id
+ @GeneratedValue(generator = "hibseq")
+ @GenericGenerator(name = "hibseq", strategy = "seqhilo",
+ parameters = {
+ @Parameter(name = "max_lo", value = "5"),
+ @Parameter(name = "sequence", value = "heybabyhey")
+ }
+ )
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+}
Copied:
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/GoalKeeper.java
(from rev 14758,
annotations/trunk/src/test/org/hibernate/test/annotations/id/GoalKeeper.java)
===================================================================
--- annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/GoalKeeper.java
(rev 0)
+++
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/GoalKeeper.java 2008-06-11
07:33:15 UTC (rev 14760)
@@ -0,0 +1,17 @@
+//$Id$
+package org.hibernate.test.annotations.id.entities;
+
+import javax.persistence.Entity;
+
+/**
+ * @author Emmanuel Bernard
+ */
+@Entity
+public class GoalKeeper extends Footballer {
+ public GoalKeeper() {
+ }
+
+ public GoalKeeper(String firstname, String lastname, String club) {
+ super( firstname, lastname, club );
+ }
+}
Copied: annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Home.java
(from rev 14758, annotations/trunk/src/test/org/hibernate/test/annotations/id/Home.java)
===================================================================
--- annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Home.java
(rev 0)
+++
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Home.java 2008-06-11
07:33:15 UTC (rev 14760)
@@ -0,0 +1,26 @@
+//$Id$
+package org.hibernate.test.annotations.id.entities;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+
+/**
+ * Default sequence generation usage
+ *
+ * @author Emmanuel Bernard
+ */
+@Entity
+public class Home {
+ private Long id;
+
+ @Id
+ @GeneratedValue
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+}
Copied:
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Location.java (from
rev 14758, annotations/trunk/src/test/org/hibernate/test/annotations/id/Location.java)
===================================================================
--- annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Location.java
(rev 0)
+++
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Location.java 2008-06-11
07:33:15 UTC (rev 14760)
@@ -0,0 +1,35 @@
+//$Id$
+package org.hibernate.test.annotations.id.entities;
+
+import java.io.Serializable;
+
+/**
+ * @author Emmanuel Bernard
+ */
+@SuppressWarnings("serial")
+public class Location implements Serializable {
+ public double longitude;
+ public double latitude;
+
+ public boolean equals(Object o) {
+ if ( this == o ) return true;
+ if ( o == null || getClass() != o.getClass() ) return false;
+
+ final Location location = (Location) o;
+
+ if ( Double.compare( location.latitude, latitude ) != 0 ) return false;
+ if ( Double.compare( location.longitude, longitude ) != 0 ) return false;
+
+ return true;
+ }
+
+ public int hashCode() {
+ int result;
+ long temp;
+ temp = longitude != +0.0d ? Double.doubleToLongBits( longitude ) : 0L;
+ result = (int) ( temp ^ ( temp >>> 32 ) );
+ temp = latitude != +0.0d ? Double.doubleToLongBits( latitude ) : 0L;
+ result = 29 * result + (int) ( temp ^ ( temp >>> 32 ) );
+ return result;
+ }
+}
Copied:
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/MilitaryBuilding.java
(from rev 14758,
annotations/trunk/src/test/org/hibernate/test/annotations/id/MilitaryBuilding.java)
===================================================================
---
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/MilitaryBuilding.java
(rev 0)
+++
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/MilitaryBuilding.java 2008-06-11
07:33:15 UTC (rev 14760)
@@ -0,0 +1,18 @@
+//$Id$
+package org.hibernate.test.annotations.id.entities;
+
+import javax.persistence.Id;
+import javax.persistence.IdClass;
+import javax.persistence.MappedSuperclass;
+
+/**
+ * @author Emmanuel Bernard
+ */
+@MappedSuperclass
+(a)IdClass(Location.class)
+public class MilitaryBuilding {
+ @Id
+ public double longitude;
+ @Id
+ public double latitude;
+}
Copied: annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Monkey.java
(from rev 14758,
annotations/trunk/src/test/org/hibernate/test/annotations/id/Monkey.java)
===================================================================
--- annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Monkey.java
(rev 0)
+++
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Monkey.java 2008-06-11
07:33:15 UTC (rev 14760)
@@ -0,0 +1,24 @@
+//$
+package org.hibernate.test.annotations.id.entities;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+
+/**
+ * @author Paul Cowan
+ */
+@Entity
+public class Monkey {
+ private String id;
+
+ @Id
+ @GeneratedValue(generator = "system-uuid-2")
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+}
Copied: annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Phone.java
(from rev 14758, annotations/trunk/src/test/org/hibernate/test/annotations/id/Phone.java)
===================================================================
--- annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Phone.java
(rev 0)
+++
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Phone.java 2008-06-11
07:33:15 UTC (rev 14760)
@@ -0,0 +1,29 @@
+//$Id$
+package org.hibernate.test.annotations.id.entities;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+
+/**
+ * @author Emmanuel Bernard
+ */
+@Entity()
+public class Phone {
+ private Integer id;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "Phone_Gen")
+ @javax.persistence.SequenceGenerator(
+ name = "Phone_Gen",
+ sequenceName = "phone_seq"
+ )
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+}
Added:
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/PointyTooth.java
===================================================================
---
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/PointyTooth.java
(rev 0)
+++
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/PointyTooth.java 2008-06-11
07:33:15 UTC (rev 14760)
@@ -0,0 +1,41 @@
+//$Id$
+package org.hibernate.test.annotations.id.entities;
+
+import java.io.Serializable;
+import java.math.BigInteger;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+
+import org.hibernate.annotations.GenericGenerator;
+
+/**
+ * Blown precision on related entity when @JoinColumn is used.
+ * Does not cause an issue on HyperSonic, but replicates nicely on PGSQL.
+ *
+ * @see ANN-748
+ * @author Andrew C. Oliver andyspam(a)osintegrators.com
+ */
+@Entity
+@SuppressWarnings("serial")
+public class PointyTooth implements Serializable {
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY, generator = "java5_uuid")
+ @GenericGenerator(name = "java5_uuid", strategy =
"org.hibernate.test.annotations.id.UUIDGenerator")
+ @Column(name = "id", precision = 128, scale = 0)
+ private BigInteger id;
+
+ @ManyToOne
+ // comment out the below line and the test will pass
+ //@JoinColumn(name = "bugs_bunny_id")
+ Bunny bunny;
+
+ public void setBunny(Bunny bunny) {
+ this.bunny = bunny;
+ }
+}
Property changes on:
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/PointyTooth.java
___________________________________________________________________
Name: svn:keywords
+ Id
Copied: annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Shoe.java
(from rev 14758, annotations/trunk/src/test/org/hibernate/test/annotations/id/Shoe.java)
===================================================================
--- annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Shoe.java
(rev 0)
+++
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Shoe.java 2008-06-11
07:33:15 UTC (rev 14760)
@@ -0,0 +1,29 @@
+//$Id$
+package org.hibernate.test.annotations.id.entities;
+
+import java.io.Serializable;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+
+/**
+ * sample of Sequance generator
+ *
+ * @author Emmanuel Bernard
+ */
+@Entity
+@SuppressWarnings("serial")
+public class Shoe implements Serializable {
+ private Long id;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_GEN")
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long long1) {
+ id = long1;
+ }
+}
Copied:
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/SoundSystem.java
(from rev 14758,
annotations/trunk/src/test/org/hibernate/test/annotations/id/SoundSystem.java)
===================================================================
---
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/SoundSystem.java
(rev 0)
+++
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/SoundSystem.java 2008-06-11
07:33:15 UTC (rev 14760)
@@ -0,0 +1,42 @@
+//$Id$
+package org.hibernate.test.annotations.id.entities;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+
+/**
+ * @author Emmanuel Bernard
+ */
+@Entity
+public class SoundSystem {
+ private String id;
+ private String brand;
+ private String model;
+
+ @Id
+ @GeneratedValue(generator = "system-uuid")
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getBrand() {
+ return brand;
+ }
+
+ public void setBrand(String brand) {
+ this.brand = brand;
+ }
+
+ public String getModel() {
+ return model;
+ }
+
+ public void setModel(String model) {
+ this.model = model;
+ }
+}
Copied: annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Store.java
(from rev 14758, annotations/trunk/src/test/org/hibernate/test/annotations/id/Store.java)
===================================================================
--- annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Store.java
(rev 0)
+++
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Store.java 2008-06-11
07:33:15 UTC (rev 14760)
@@ -0,0 +1,33 @@
+//$Id$
+package org.hibernate.test.annotations.id.entities;
+
+import java.io.Serializable;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+
+/**
+ * Sample of class generator
+ *
+ * @author Emmanuel Bernard
+ */
+@Entity
+(a)javax.persistence.SequenceGenerator(
+ name = "SEQ_STORE",
+ sequenceName = "my_sequence"
+)
+@SuppressWarnings("serial")
+public class Store implements Serializable {
+ private Long id;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_STORE")
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long long1) {
+ id = long1;
+ }
+}
Copied: annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Tower.java
(from rev 14758, annotations/trunk/src/test/org/hibernate/test/annotations/id/Tower.java)
===================================================================
--- annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Tower.java
(rev 0)
+++
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Tower.java 2008-06-11
07:33:15 UTC (rev 14760)
@@ -0,0 +1,14 @@
+//$Id$
+package org.hibernate.test.annotations.id.entities;
+
+import javax.persistence.AttributeOverride;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+
+/**
+ * @author Emmanuel Bernard
+ */
+@Entity
+@AttributeOverride(name = "longitude", column = @Column(name =
"fld_longitude"))
+public class Tower extends MilitaryBuilding {
+}
Copied: annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Tree.java
(from rev 14758, annotations/trunk/src/test/org/hibernate/test/annotations/id/Tree.java)
===================================================================
--- annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Tree.java
(rev 0)
+++
annotations/trunk/src/test/org/hibernate/test/annotations/id/entities/Tree.java 2008-06-11
07:33:15 UTC (rev 14760)
@@ -0,0 +1,24 @@
+//$Id$
+package org.hibernate.test.annotations.id.entities;
+
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.MappedSuperclass;
+
+/**
+ * @author Emmanuel Bernard
+ */
+@MappedSuperclass
+public class Tree {
+ private Integer id;
+
+ @Id
+ @GeneratedValue
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+}