Author: steve.ebersole(a)jboss.com
Date: 2010-02-04 14:32:54 -0500 (Thu, 04 Feb 2010)
New Revision: 18695
Added:
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/embedded/many2one/
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/embedded/many2one/Address.java
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/embedded/many2one/Country.java
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/embedded/many2one/EmbeddableWithMany2OneTest.java
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/embedded/many2one/Person.java
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/embedded/one2many/
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/embedded/one2many/Alias.java
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/embedded/one2many/EmbeddableWithOne2ManyTest.java
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/embedded/one2many/Name.java
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/embedded/one2many/Person.java
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/embedded/one2many/PersonName.java
Modified:
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/TestCase.java
core/trunk/entitymanager/src/test/java/org/hibernate/ejb/test/TestCase.java
Log:
HHH-4599 - An embeddable class may contain ToOne or ToMany associations
Modified:
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/TestCase.java
===================================================================
---
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/TestCase.java 2010-02-04
18:25:03 UTC (rev 18694)
+++
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/TestCase.java 2010-02-04
19:32:54 UTC (rev 18695)
@@ -95,6 +95,8 @@
}
try {
setCfg( new AnnotationConfiguration() );
+ // by default use the new id generator scheme...
+ cfg.setProperty( AnnotationConfiguration.USE_NEW_ID_GENERATOR_MAPPINGS,
"true" );
configure( cfg );
if ( recreateSchema() ) {
cfg.setProperty( Environment.HBM2DDL_AUTO, "create-drop" );
Added:
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/embedded/many2one/Address.java
===================================================================
---
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/embedded/many2one/Address.java
(rev 0)
+++
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/embedded/many2one/Address.java 2010-02-04
19:32:54 UTC (rev 18695)
@@ -0,0 +1,85 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.test.annotations.embedded.many2one;
+
+import javax.persistence.Embeddable;
+import javax.persistence.ManyToOne;
+
+import org.hibernate.annotations.AccessType;
+
+/**
+ * TODO : javadoc
+ *
+ * @author Steve Ebersole
+ */
+@Embeddable
+@AccessType("property")
+public class Address {
+ private String line1;
+ private String line2;
+ private String city;
+ private Country country;
+ private String postalCode;
+
+ public String getLine1() {
+ return line1;
+ }
+
+ public void setLine1(String line1) {
+ this.line1 = line1;
+ }
+
+ public String getLine2() {
+ return line2;
+ }
+
+ public void setLine2(String line2) {
+ this.line2 = line2;
+ }
+
+ public String getCity() {
+ return city;
+ }
+
+ public void setCity(String city) {
+ this.city = city;
+ }
+
+ @ManyToOne
+ public Country getCountry() {
+ return country;
+ }
+
+ public void setCountry(Country country) {
+ this.country = country;
+ }
+
+ public String getPostalCode() {
+ return postalCode;
+ }
+
+ public void setPostalCode(String postalCode) {
+ this.postalCode = postalCode;
+ }
+}
Copied:
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/embedded/many2one/Country.java
(from rev 18674,
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/embedded/Country.java)
===================================================================
---
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/embedded/many2one/Country.java
(rev 0)
+++
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/embedded/many2one/Country.java 2010-02-04
19:32:54 UTC (rev 18695)
@@ -0,0 +1,64 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.test.annotations.embedded.many2one;
+
+import java.io.Serializable;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+
+/**
+ * THe entity target of the many-to-one from a component/embeddable.
+ *
+ * @author Steve Ebersole
+ */
+@Entity
+public class Country implements Serializable {
+ private String iso2;
+ private String name;
+
+ public Country() {
+ }
+
+ public Country(String iso2, String name) {
+ this.iso2 = iso2;
+ this.name = name;
+ }
+
+ @Id
+ public String getIso2() {
+ return iso2;
+ }
+
+ public void setIso2(String iso2) {
+ this.iso2 = iso2;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
\ No newline at end of file
Added:
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/embedded/many2one/EmbeddableWithMany2OneTest.java
===================================================================
---
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/embedded/many2one/EmbeddableWithMany2OneTest.java
(rev 0)
+++
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/embedded/many2one/EmbeddableWithMany2OneTest.java 2010-02-04
19:32:54 UTC (rev 18695)
@@ -0,0 +1,85 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.test.annotations.embedded.many2one;
+
+import java.util.List;
+
+import org.hibernate.Session;
+import org.hibernate.junit.FailureExpected;
+import org.hibernate.test.annotations.TestCase;
+
+/**
+ * TODO : javadoc
+ *
+ * @author Steve Ebersole
+ */
+public class EmbeddableWithMany2OneTest extends TestCase {
+ @Override
+ protected Class<?>[] getAnnotatedClasses() {
+ return new Class[] { Person.class, Country.class };
+ }
+
+ @FailureExpected( jiraKey = "HHH-4883")
+ public void testJoinAcrossEmbedded() {
+ Session session = openSession();
+ session.beginTransaction();
+ session.createQuery( "from Person p join p.address as a join a.country as c where
c.name = 'US'" )
+ .list();
+ session.createQuery( "from Person p join p.address as a join a.country as c where
c.id = 'US'" )
+ .list();
+ session.getTransaction().commit();
+ session.close();
+ }
+
+ public void testBasicOps() {
+ Session session = openSession();
+ session.beginTransaction();
+ Country country = new Country( "US", "United States of America" );
+ session.persist( country );
+ Person person = new Person( "Steve", new Address() );
+ person.getAddress().setLine1( "123 Main" );
+ person.getAddress().setCity( "Anywhere" );
+ person.getAddress().setCountry( country );
+ person.getAddress().setPostalCode( "123456789" );
+ session.persist( person );
+ session.getTransaction().commit();
+ session.close();
+
+ session = openSession();
+ session.beginTransaction();
+ session.createQuery( "from Person p where p.address.country.iso2 =
'US'" )
+ .list();
+ // same query!
+ session.createQuery( "from Person p where p.address.country.id =
'US'" )
+ .list();
+ person = (Person) session.load( Person.class, person.getId() );
+ session.delete( person );
+ List countries = session.createQuery( "from Country" ).list();
+ assertEquals( 1, countries.size() );
+ session.delete( countries.get( 0 ) );
+
+ session.getTransaction().commit();
+ session.close();
+ }
+}
Added:
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/embedded/many2one/Person.java
===================================================================
---
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/embedded/many2one/Person.java
(rev 0)
+++
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/embedded/many2one/Person.java 2010-02-04
19:32:54 UTC (rev 18695)
@@ -0,0 +1,77 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.test.annotations.embedded.many2one;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+
+/**
+ * TODO : javadoc
+ *
+ * @author Steve Ebersole
+ */
+@Entity
+public class Person {
+ private Long id;
+ private String name;
+ private Address address;
+
+ public Person() {
+ }
+
+ public Person(String name) {
+ this.name = name;
+ }
+
+ public Person(String name, Address address) {
+ this.name = name;
+ this.address = address;
+ }
+
+ @Id @GeneratedValue
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Address getAddress() {
+ return address;
+ }
+
+ public void setAddress(Address address) {
+ this.address = address;
+ }
+}
Added:
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/embedded/one2many/Alias.java
===================================================================
---
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/embedded/one2many/Alias.java
(rev 0)
+++
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/embedded/one2many/Alias.java 2010-02-04
19:32:54 UTC (rev 18695)
@@ -0,0 +1,78 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.test.annotations.embedded.one2many;
+
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+
+import org.hibernate.annotations.Entity;
+
+/**
+ * TODO : javadoc
+ *
+ * @author Steve Ebersole
+ */
+@Entity
+public class Alias {
+ private Long id;
+ private Name name;
+ private String source;
+
+ public Alias() {
+ }
+
+ public Alias(String firstName, String lastName, String source) {
+ this( new PersonName( firstName, lastName ), source );
+ }
+
+ public Alias(Name name, String source) {
+ this.name = name;
+ this.source = source;
+ }
+
+ @Id @GeneratedValue
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public Name getName() {
+ return name;
+ }
+
+ public void setName(Name name) {
+ this.name = name;
+ }
+
+ public String getSource() {
+ return source;
+ }
+
+ public void setSource(String source) {
+ this.source = source;
+ }
+}
Added:
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/embedded/one2many/EmbeddableWithOne2ManyTest.java
===================================================================
---
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/embedded/one2many/EmbeddableWithOne2ManyTest.java
(rev 0)
+++
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/embedded/one2many/EmbeddableWithOne2ManyTest.java 2010-02-04
19:32:54 UTC (rev 18695)
@@ -0,0 +1,74 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.test.annotations.embedded.one2many;
+
+import java.util.List;
+
+import org.hibernate.Session;
+import org.hibernate.junit.FailureExpected;
+import org.hibernate.test.annotations.TestCase;
+
+/**
+ * TODO : javadoc
+ *
+ * @author Steve Ebersole
+ */
+public class EmbeddableWithOne2ManyTest extends TestCase {
+ @Override
+ protected Class<?>[] getAnnotatedClasses() {
+ return new Class[] { Alias.class, Person.class };
+ }
+
+ @FailureExpected( jiraKey = "HHH-4883")
+ public void testJoinAcrossEmbedded() {
+ Session session = openSession();
+ session.beginTransaction();
+ session.createQuery( "from Person p join p.name.aliases a where a.source =
'FBI'" )
+ .list();
+ session.getTransaction().commit();
+ session.close();
+ }
+
+ @FailureExpected( jiraKey = "HHH-4599")
+ public void testBasicOps() {
+ Session session = openSession();
+ session.beginTransaction();
+ Alias alias = new Alias( "Public Enemy", "Number 1",
"FBI" );
+ session.persist( alias );
+ Person person = new Person( "John", "Dillinger" );
+ person.getName().getAliases().add( alias );
+ session.persist( person );
+ session.getTransaction().commit();
+ session.close();
+
+ session = openSession();
+ session.beginTransaction();
+ person = (Person) session.load( Person.class, person.getId() );
+ session.delete( person );
+ List aliases = session.createQuery( "from Alias" ).list();
+ assertEquals( 0, aliases.size() );
+ session.getTransaction().commit();
+ session.close();
+ }
+}
\ No newline at end of file
Added:
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/embedded/one2many/Name.java
===================================================================
---
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/embedded/one2many/Name.java
(rev 0)
+++
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/embedded/one2many/Name.java 2010-02-04
19:32:54 UTC (rev 18695)
@@ -0,0 +1,64 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.test.annotations.embedded.one2many;
+
+import javax.persistence.Embeddable;
+
+import org.hibernate.annotations.AccessType;
+
+/**
+ * TODO : javadoc
+ *
+ * @author Steve Ebersole
+ */
+@Embeddable
+@AccessType("property")
+public class Name {
+ private String first;
+ private String last;
+
+ public Name() {
+ }
+
+ public Name(String first, String last) {
+ this.first = first;
+ this.last = last;
+ }
+
+ public String getFirst() {
+ return first;
+ }
+
+ public void setFirst(String first) {
+ this.first = first;
+ }
+
+ public String getLast() {
+ return last;
+ }
+
+ public void setLast(String last) {
+ this.last = last;
+ }
+}
Added:
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/embedded/one2many/Person.java
===================================================================
---
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/embedded/one2many/Person.java
(rev 0)
+++
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/embedded/one2many/Person.java 2010-02-04
19:32:54 UTC (rev 18695)
@@ -0,0 +1,67 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.test.annotations.embedded.one2many;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+
+/**
+ * TODO : javadoc
+ *
+ * @author Steve Ebersole
+ */
+@Entity
+public class Person {
+ private Long id;
+ private PersonName name;
+
+ public Person() {
+ }
+
+ public Person(String firstName, String lastName) {
+ this( new PersonName( firstName, lastName ) );
+ }
+
+ public Person(PersonName name) {
+ this.name = name;
+ }
+
+ @Id @GeneratedValue
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public PersonName getName() {
+ return name;
+ }
+
+ public void setName(PersonName name) {
+ this.name = name;
+ }
+}
Added:
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/embedded/one2many/PersonName.java
===================================================================
---
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/embedded/one2many/PersonName.java
(rev 0)
+++
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/embedded/one2many/PersonName.java 2010-02-04
19:32:54 UTC (rev 18695)
@@ -0,0 +1,59 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.test.annotations.embedded.one2many;
+
+import java.util.HashSet;
+import java.util.Set;
+import javax.persistence.CascadeType;
+import javax.persistence.Embeddable;
+import javax.persistence.OneToMany;
+
+import org.hibernate.annotations.AccessType;
+
+/**
+ * TODO : javadoc
+ *
+ * @author Steve Ebersole
+ */
+@Embeddable
+@AccessType("property")
+public class PersonName extends Name {
+ private Set<Alias> aliases = new HashSet<Alias>();
+
+ public PersonName() {
+ }
+
+ public PersonName(String first, String last) {
+ super( first, last );
+ }
+
+ @OneToMany( cascade = CascadeType.ALL )
+ public Set<Alias> getAliases() {
+ return aliases;
+ }
+
+ public void setAliases(Set<Alias> aliases) {
+ this.aliases = aliases;
+ }
+}
Modified: core/trunk/entitymanager/src/test/java/org/hibernate/ejb/test/TestCase.java
===================================================================
--- core/trunk/entitymanager/src/test/java/org/hibernate/ejb/test/TestCase.java 2010-02-04
18:25:03 UTC (rev 18694)
+++ core/trunk/entitymanager/src/test/java/org/hibernate/ejb/test/TestCase.java 2010-02-04
19:32:54 UTC (rev 18695)
@@ -38,6 +38,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.cfg.Environment;
import org.hibernate.dialect.Dialect;
import org.hibernate.ejb.AvailableSettings;
@@ -79,6 +80,7 @@
if ( recreateSchema() ) {
cfg.setProperty( Environment.HBM2DDL_AUTO, "create-drop" );
}
+ cfg.setProperty( AnnotationConfiguration.USE_NEW_ID_GENERATOR_MAPPINGS,
"true" );
factory = ejbconfig.createEntityManagerFactory( getConfig() );
}