Author: steve.ebersole(a)jboss.com
Date: 2007-01-23 07:54:10 -0500 (Tue, 23 Jan 2007)
New Revision: 11076
Added:
trunk/Hibernate3/test/org/hibernate/test/keymanytoone/
trunk/Hibernate3/test/org/hibernate/test/keymanytoone/KeyManyToOneSuite.java
trunk/Hibernate3/test/org/hibernate/test/keymanytoone/bidir/
trunk/Hibernate3/test/org/hibernate/test/keymanytoone/bidir/component/
trunk/Hibernate3/test/org/hibernate/test/keymanytoone/bidir/component/Customer.java
trunk/Hibernate3/test/org/hibernate/test/keymanytoone/bidir/component/EagerKeyManyToOneTest.java
trunk/Hibernate3/test/org/hibernate/test/keymanytoone/bidir/component/EagerMapping.hbm.xml
trunk/Hibernate3/test/org/hibernate/test/keymanytoone/bidir/component/LazyKeyManyToOneTest.java
trunk/Hibernate3/test/org/hibernate/test/keymanytoone/bidir/component/LazyMapping.hbm.xml
trunk/Hibernate3/test/org/hibernate/test/keymanytoone/bidir/component/Order.java
trunk/Hibernate3/test/org/hibernate/test/keymanytoone/bidir/embedded/
trunk/Hibernate3/test/org/hibernate/test/keymanytoone/bidir/embedded/Customer.java
trunk/Hibernate3/test/org/hibernate/test/keymanytoone/bidir/embedded/KeyManyToOneTest.java
trunk/Hibernate3/test/org/hibernate/test/keymanytoone/bidir/embedded/Mapping.hbm.xml
trunk/Hibernate3/test/org/hibernate/test/keymanytoone/bidir/embedded/Order.java
Modified:
trunk/Hibernate3/test/org/hibernate/test/AllTests.java
Log:
HHH-2277 : key-many-to-one (bidir + eager) : tests
Modified: trunk/Hibernate3/test/org/hibernate/test/AllTests.java
===================================================================
--- trunk/Hibernate3/test/org/hibernate/test/AllTests.java 2007-01-22 18:59:20 UTC (rev
11075)
+++ trunk/Hibernate3/test/org/hibernate/test/AllTests.java 2007-01-23 12:54:10 UTC (rev
11076)
@@ -58,6 +58,7 @@
import org.hibernate.test.joinedsubclass.JoinedSubclassTest;
import org.hibernate.test.joinfetch.JoinFetchTest;
import org.hibernate.test.jpa.JPAComplianceSuite;
+import org.hibernate.test.keymanytoone.KeyManyToOneSuite;
import org.hibernate.test.lazycache.InstrumentCacheTest;
import org.hibernate.test.lazycache.InstrumentCacheTest2;
import org.hibernate.test.lazyonetoone.LazyOneToOneTest;
@@ -275,9 +276,9 @@
suite.addTest( IdentifierPropertyReferencesTest.suite() );
suite.addTest( DeleteTransientEntityTest.suite() );
suite.addTest( UserCollectionTypeTest.suite() );
+ suite.addTest( KeyManyToOneSuite.suite() );
return filter( suite );
- //return suite;
}
/**
Added: trunk/Hibernate3/test/org/hibernate/test/keymanytoone/KeyManyToOneSuite.java
===================================================================
--- trunk/Hibernate3/test/org/hibernate/test/keymanytoone/KeyManyToOneSuite.java
(rev 0)
+++
trunk/Hibernate3/test/org/hibernate/test/keymanytoone/KeyManyToOneSuite.java 2007-01-23
12:54:10 UTC (rev 11076)
@@ -0,0 +1,23 @@
+package org.hibernate.test.keymanytoone;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.hibernate.test.keymanytoone.bidir.embedded.KeyManyToOneTest;
+import org.hibernate.test.keymanytoone.bidir.component.LazyKeyManyToOneTest;
+import org.hibernate.test.keymanytoone.bidir.component.EagerKeyManyToOneTest;
+
+/**
+ * {@inheritDoc}
+ *
+ * @author Steve Ebersole
+ */
+public class KeyManyToOneSuite {
+ public static Test suite() {
+ TestSuite suite = new TestSuite( "key-many-to-one mappings" );
+ suite.addTest( KeyManyToOneTest.suite() );
+ suite.addTest( LazyKeyManyToOneTest.suite() );
+ suite.addTest( EagerKeyManyToOneTest.suite() );
+ return suite;
+ }
+}
Added:
trunk/Hibernate3/test/org/hibernate/test/keymanytoone/bidir/component/Customer.java
===================================================================
--- trunk/Hibernate3/test/org/hibernate/test/keymanytoone/bidir/component/Customer.java
(rev 0)
+++
trunk/Hibernate3/test/org/hibernate/test/keymanytoone/bidir/component/Customer.java 2007-01-23
12:54:10 UTC (rev 11076)
@@ -0,0 +1,46 @@
+package org.hibernate.test.keymanytoone.bidir.component;
+
+import java.util.Collection;
+import java.util.ArrayList;
+
+/**
+ * {@inheritDoc}
+ *
+ * @author Steve Ebersole
+ */
+public class Customer {
+ private Long id;
+ private String name;
+ private Collection orders = new ArrayList();
+
+ public Customer() {
+ }
+
+ public Customer(String name) {
+ this.name = name;
+ }
+
+ 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 Collection getOrders() {
+ return orders;
+ }
+
+ public void setOrders(Collection orders) {
+ this.orders = orders;
+ }
+}
Added:
trunk/Hibernate3/test/org/hibernate/test/keymanytoone/bidir/component/EagerKeyManyToOneTest.java
===================================================================
---
trunk/Hibernate3/test/org/hibernate/test/keymanytoone/bidir/component/EagerKeyManyToOneTest.java
(rev 0)
+++
trunk/Hibernate3/test/org/hibernate/test/keymanytoone/bidir/component/EagerKeyManyToOneTest.java 2007-01-23
12:54:10 UTC (rev 11076)
@@ -0,0 +1,92 @@
+package org.hibernate.test.keymanytoone.bidir.component;
+
+import junit.framework.Test;
+
+import org.hibernate.Session;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.cfg.Environment;
+import org.hibernate.junit.functional.FunctionalTestClassTestSuite;
+import org.hibernate.test.TestCase;
+
+/**
+ * @author Steve Ebersole
+ */
+public class EagerKeyManyToOneTest extends TestCase {
+ public EagerKeyManyToOneTest(String name) {
+ super( name );
+ }
+
+ protected String[] getMappings() {
+ return new String[] { "keymanytoone/bidir/component/EagerMapping.hbm.xml" };
+ }
+
+ public static Test suite() {
+ return new FunctionalTestClassTestSuite( EagerKeyManyToOneTest.class );
+ }
+
+ protected void configure(Configuration cfg) {
+ super.configure( cfg );
+ cfg.setProperty( Environment.GENERATE_STATISTICS, "true" );
+ }
+
+ public void testSaveCascadedToKeyManyToOne() {
+ // test cascading a save to an association with a key-many-to-one which refers to a
+ // just saved entity
+ Session s = openSession();
+ s.beginTransaction();
+ Customer cust = new Customer( "Acme, Inc." );
+ Order order = new Order( new Order.Id( cust, 1 ) );
+ cust.getOrders().add( order );
+ s.save( cust );
+ s.flush();
+ assertEquals( 2, sfi().getStatistics().getEntityInsertCount() );
+ s.delete( cust );
+ s.getTransaction().commit();
+ s.close();
+ }
+
+ public void testLoadingStrategies() {
+ Session s = openSession();
+ s.beginTransaction();
+ Customer cust = new Customer( "Acme, Inc." );
+ Order order = new Order( new Order.Id( cust, 1 ) );
+ cust.getOrders().add( order );
+ s.save( cust );
+ s.getTransaction().commit();
+ s.close();
+
+ s = openSession();
+ s.beginTransaction();
+
+// Here is an example of HHH-2277
+// essentially we have a bidirectional association where one side of the
+// association is actually part of a composite PK
+//
+// The way these are mapped causes the problem because both sides
+// are defined as eager which leads to the infinite loop; if only
+// one side is marked as eager, then all is ok...
+// cust = ( Customer ) s.get( Customer.class, cust.getId() );
+// assertEquals( 1, cust.getOrders().size() );
+// s.clear();
+
+ cust = ( Customer ) s.createQuery( "from Customer" ).uniqueResult();
+ assertEquals( 1, cust.getOrders().size() );
+ s.clear();
+
+ cust = ( Customer ) s.createQuery( "from Customer c join fetch c.orders"
).uniqueResult();
+ assertEquals( 1, cust.getOrders().size() );
+ s.clear();
+
+ cust = ( Customer ) s.createQuery( "from Customer c join fetch c.orders as o join
fetch o.id.customer" ).uniqueResult();
+ assertEquals( 1, cust.getOrders().size() );
+ s.clear();
+
+ cust = ( Customer ) s.createCriteria( Customer.class ).uniqueResult();
+ assertEquals( 1, cust.getOrders().size() );
+ s.clear();
+
+ s.delete( cust );
+ s.getTransaction().commit();
+ s.close();
+ }
+}
Added:
trunk/Hibernate3/test/org/hibernate/test/keymanytoone/bidir/component/EagerMapping.hbm.xml
===================================================================
---
trunk/Hibernate3/test/org/hibernate/test/keymanytoone/bidir/component/EagerMapping.hbm.xml
(rev 0)
+++
trunk/Hibernate3/test/org/hibernate/test/keymanytoone/bidir/component/EagerMapping.hbm.xml 2007-01-23
12:54:10 UTC (rev 11076)
@@ -0,0 +1,42 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<!--
+ This mapping demonstrates the use of composite ids with the
+ key-many-to-one feature. Essentially a composite id where part
+ of the composition is a foreign-key to another entity.
+
+ Here, specifically, we map the key-many-to-one as a lazy
+ association.
+-->
+
+<hibernate-mapping
package="org.hibernate.test.keymanytoone.bidir.component">
+
+ <class name="Customer" table="COMP_LAZY_KM2O_CUST">
+ <id name="id" column="ID" type="long">
+ <generator class="increment" />
+ </id>
+ <property name="name" column="NAME"
type="string" />
+ <bag name="orders" inverse="true" cascade="all"
lazy="false" fetch="join">
+ <key column="CUST_ID" />
+ <one-to-many class="Order" />
+ </bag>
+ </class>
+
+ <class name="Order" table="COMP_LAZY_KM2O_ORDR">
+ <composite-id name="id" class="Order$Id">
+ <key-many-to-one name="customer" class="Customer"
column="CUST_ID" lazy="false"/>
+ <key-property name="number" column="ORDR_NUM"
type="long" />
+ </composite-id>
+ <set name="items" table="COMP_LAZY_KM2O_ITEM">
+ <key>
+ <column name="CUST_ID"/>
+ <column name="ORDER_NUM"/>
+ </key>
+ <element type="string" column="ITEM_DESC" />
+ </set>
+ </class>
+
+</hibernate-mapping>
Added:
trunk/Hibernate3/test/org/hibernate/test/keymanytoone/bidir/component/LazyKeyManyToOneTest.java
===================================================================
---
trunk/Hibernate3/test/org/hibernate/test/keymanytoone/bidir/component/LazyKeyManyToOneTest.java
(rev 0)
+++
trunk/Hibernate3/test/org/hibernate/test/keymanytoone/bidir/component/LazyKeyManyToOneTest.java 2007-01-23
12:54:10 UTC (rev 11076)
@@ -0,0 +1,77 @@
+package org.hibernate.test.keymanytoone.bidir.component;
+
+import junit.framework.Test;
+
+import org.hibernate.test.TestCase;
+import org.hibernate.junit.functional.FunctionalTestClassTestSuite;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.cfg.Environment;
+import org.hibernate.Session;
+
+/**
+ * @author Steve Ebersole
+ */
+public class LazyKeyManyToOneTest extends TestCase {
+ public LazyKeyManyToOneTest(String name) {
+ super( name );
+ }
+
+ protected String[] getMappings() {
+ return new String[] { "keymanytoone/bidir/component/LazyMapping.hbm.xml" };
+ }
+
+ public static Test suite() {
+ return new FunctionalTestClassTestSuite( LazyKeyManyToOneTest.class );
+ }
+
+ protected void configure(Configuration cfg) {
+ super.configure( cfg );
+ cfg.setProperty( Environment.GENERATE_STATISTICS, "true" );
+ }
+
+ public void testSaveCascadedToKeyManyToOne() {
+ // test cascading a save to an association with a key-many-to-one which refers to a
+ // just saved entity
+ Session s = openSession();
+ s.beginTransaction();
+ Customer cust = new Customer( "Acme, Inc." );
+ Order order = new Order( new Order.Id( cust, 1 ) );
+ cust.getOrders().add( order );
+ s.save( cust );
+ s.flush();
+ assertEquals( 2, sfi().getStatistics().getEntityInsertCount() );
+ s.delete( cust );
+ s.getTransaction().commit();
+ s.close();
+ }
+
+ public void testLoadingStrategies() {
+ Session s = openSession();
+ s.beginTransaction();
+ Customer cust = new Customer( "Acme, Inc." );
+ Order order = new Order( new Order.Id( cust, 1 ) );
+ cust.getOrders().add( order );
+ s.save( cust );
+ s.getTransaction().commit();
+ s.close();
+
+ s = openSession();
+ s.beginTransaction();
+
+ cust = ( Customer ) s.get( Customer.class, cust.getId() );
+ assertEquals( 1, cust.getOrders().size() );
+ s.clear();
+
+ cust = ( Customer ) s.createQuery( "from Customer" ).uniqueResult();
+ assertEquals( 1, cust.getOrders().size() );
+ s.clear();
+
+ cust = ( Customer ) s.createQuery( "from Customer c join fetch c.orders"
).uniqueResult();
+ assertEquals( 1, cust.getOrders().size() );
+ s.clear();
+
+ s.delete( cust );
+ s.getTransaction().commit();
+ s.close();
+ }
+}
Added:
trunk/Hibernate3/test/org/hibernate/test/keymanytoone/bidir/component/LazyMapping.hbm.xml
===================================================================
---
trunk/Hibernate3/test/org/hibernate/test/keymanytoone/bidir/component/LazyMapping.hbm.xml
(rev 0)
+++
trunk/Hibernate3/test/org/hibernate/test/keymanytoone/bidir/component/LazyMapping.hbm.xml 2007-01-23
12:54:10 UTC (rev 11076)
@@ -0,0 +1,42 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<!--
+ This mapping demonstrates the use of composite ids with the
+ key-many-to-one feature. Essentially a composite id where part
+ of the composition is a foreign-key to another entity.
+
+ Here, specifically, we map the key-many-to-one as a lazy
+ association.
+-->
+
+<hibernate-mapping
package="org.hibernate.test.keymanytoone.bidir.component">
+
+ <class name="Customer" table="COMP_LAZY_KM2O_CUST">
+ <id name="id" column="ID" type="long">
+ <generator class="increment" />
+ </id>
+ <property name="name" column="NAME"
type="string" />
+ <bag name="orders" inverse="true"
cascade="all">
+ <key column="CUST_ID" />
+ <one-to-many class="Order" />
+ </bag>
+ </class>
+
+ <class name="Order" table="COMP_LAZY_KM2O_ORDR">
+ <composite-id name="id" class="Order$Id">
+ <key-many-to-one name="customer" class="Customer"
column="CUST_ID" lazy="proxy"/>
+ <key-property name="number" column="ORDR_NUM"
type="long" />
+ </composite-id>
+ <set name="items" table="COMP_LAZY_KM2O_ITEM">
+ <key>
+ <column name="CUST_ID"/>
+ <column name="ORDER_NUM"/>
+ </key>
+ <element type="string" column="ITEM_DESC" />
+ </set>
+ </class>
+
+</hibernate-mapping>
Added: trunk/Hibernate3/test/org/hibernate/test/keymanytoone/bidir/component/Order.java
===================================================================
--- trunk/Hibernate3/test/org/hibernate/test/keymanytoone/bidir/component/Order.java
(rev 0)
+++
trunk/Hibernate3/test/org/hibernate/test/keymanytoone/bidir/component/Order.java 2007-01-23
12:54:10 UTC (rev 11076)
@@ -0,0 +1,86 @@
+package org.hibernate.test.keymanytoone.bidir.component;
+
+import java.io.Serializable;
+import java.util.Set;
+import java.util.HashSet;
+
+/**
+ * {@inheritDoc}
+ *
+ * @author Steve Ebersole
+ */
+public class Order {
+ private Id id;
+ private Set items = new HashSet();
+
+ public Order() {
+ }
+
+ public Order(Id id) {
+ this.id = id;
+ }
+
+ public Id getId() {
+ return id;
+ }
+
+ public void setId(Id id) {
+ this.id = id;
+ }
+
+ public Set getItems() {
+ return items;
+ }
+
+ public void setItems(Set items) {
+ this.items = items;
+ }
+
+ public static class Id implements Serializable {
+ private Customer customer;
+ private long number;
+
+ public Id() {
+ }
+
+ public Id(Customer customer, long number) {
+ this.customer = customer;
+ this.number = number;
+ }
+
+ public Customer getCustomer() {
+ return customer;
+ }
+
+ public void setCustomer(Customer customer) {
+ this.customer = customer;
+ }
+
+ public long getNumber() {
+ return number;
+ }
+
+ public void setNumber(long number) {
+ this.number = number;
+ }
+
+ public boolean equals(Object o) {
+ if ( this == o ) {
+ return true;
+ }
+ if ( o == null || getClass() != o.getClass() ) {
+ return false;
+ }
+
+ Id id = ( Id ) o;
+ return number == id.number && customer.equals( id.customer );
+ }
+
+ public int hashCode() {
+ int result;
+ result = customer.hashCode();
+ result = 31 * result + ( int ) ( number ^ ( number >>> 32 ) );
+ return result;
+ }
+ }
+}
Added: trunk/Hibernate3/test/org/hibernate/test/keymanytoone/bidir/embedded/Customer.java
===================================================================
--- trunk/Hibernate3/test/org/hibernate/test/keymanytoone/bidir/embedded/Customer.java
(rev 0)
+++
trunk/Hibernate3/test/org/hibernate/test/keymanytoone/bidir/embedded/Customer.java 2007-01-23
12:54:10 UTC (rev 11076)
@@ -0,0 +1,46 @@
+package org.hibernate.test.keymanytoone.bidir.embedded;
+
+import java.util.Collection;
+import java.util.ArrayList;
+
+/**
+ * {@inheritDoc}
+ *
+ * @author Steve Ebersole
+ */
+public class Customer {
+ private Long id;
+ private String name;
+ private Collection orders = new ArrayList();
+
+ public Customer() {
+ }
+
+ public Customer(String name) {
+ this.name = name;
+ }
+
+ 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 Collection getOrders() {
+ return orders;
+ }
+
+ public void setOrders(Collection orders) {
+ this.orders = orders;
+ }
+}
Added:
trunk/Hibernate3/test/org/hibernate/test/keymanytoone/bidir/embedded/KeyManyToOneTest.java
===================================================================
---
trunk/Hibernate3/test/org/hibernate/test/keymanytoone/bidir/embedded/KeyManyToOneTest.java
(rev 0)
+++
trunk/Hibernate3/test/org/hibernate/test/keymanytoone/bidir/embedded/KeyManyToOneTest.java 2007-01-23
12:54:10 UTC (rev 11076)
@@ -0,0 +1,77 @@
+package org.hibernate.test.keymanytoone.bidir.embedded;
+
+import junit.framework.Test;
+
+import org.hibernate.test.TestCase;
+import org.hibernate.Session;
+import org.hibernate.junit.functional.FunctionalTestClassTestSuite;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.cfg.Environment;
+
+/**
+ * @author Steve Ebersole
+ */
+public class KeyManyToOneTest extends TestCase {
+ public KeyManyToOneTest(String name) {
+ super( name );
+ }
+
+ protected String[] getMappings() {
+ return new String[] { "keymanytoone/bidir/embedded/Mapping.hbm.xml" };
+ }
+
+ public static Test suite() {
+ return new FunctionalTestClassTestSuite( KeyManyToOneTest.class );
+ }
+
+ protected void configure(Configuration cfg) {
+ super.configure( cfg );
+ cfg.setProperty( Environment.GENERATE_STATISTICS, "true" );
+ }
+
+ public void testSaveCascadedToKeyManyToOne() {
+ // test cascading a save to an association with a key-many-to-one which refers to a
+ // just saved entity
+ Session s = openSession();
+ s.beginTransaction();
+ Customer cust = new Customer( "Acme, Inc." );
+ Order order = new Order( cust, 1 );
+ cust.getOrders().add( order );
+ s.save( cust );
+ s.flush();
+ assertEquals( 2, sfi().getStatistics().getEntityInsertCount() );
+ s.delete( cust );
+ s.getTransaction().commit();
+ s.close();
+ }
+
+ public void testLoadingStrategies() {
+ Session s = openSession();
+ s.beginTransaction();
+ Customer cust = new Customer( "Acme, Inc." );
+ Order order = new Order( cust, 1 );
+ cust.getOrders().add( order );
+ s.save( cust );
+ s.getTransaction().commit();
+ s.close();
+
+ s = openSession();
+ s.beginTransaction();
+
+ cust = ( Customer ) s.get( Customer.class, cust.getId() );
+ assertEquals( 1, cust.getOrders().size() );
+ s.clear();
+
+ cust = ( Customer ) s.createQuery( "from Customer" ).uniqueResult();
+ assertEquals( 1, cust.getOrders().size() );
+ s.clear();
+
+ cust = ( Customer ) s.createQuery( "from Customer c join fetch c.orders"
).uniqueResult();
+ assertEquals( 1, cust.getOrders().size() );
+ s.clear();
+
+ s.delete( cust );
+ s.getTransaction().commit();
+ s.close();
+ }
+}
Added:
trunk/Hibernate3/test/org/hibernate/test/keymanytoone/bidir/embedded/Mapping.hbm.xml
===================================================================
--- trunk/Hibernate3/test/org/hibernate/test/keymanytoone/bidir/embedded/Mapping.hbm.xml
(rev 0)
+++
trunk/Hibernate3/test/org/hibernate/test/keymanytoone/bidir/embedded/Mapping.hbm.xml 2007-01-23
12:54:10 UTC (rev 11076)
@@ -0,0 +1,39 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<!--
+ This mapping demonstrates the use of composite ids with the
+ key-many-to-one feature where the composite-id is an embedded form.
+ Essentially a composite id where part of the composition is a
+ foreign-key to another entity.
+-->
+
+<hibernate-mapping
package="org.hibernate.test.keymanytoone.bidir.embedded">
+
+ <class name="Customer" table="EMBD_KM2O_CUST">
+ <id name="id" column="ID" type="long">
+ <generator class="increment" />
+ </id>
+ <property name="name" column="NAME"
type="string" />
+ <bag name="orders" inverse="true"
cascade="all">
+ <key column="CUST_ID" />
+ <one-to-many class="Order" />
+ </bag>
+ </class>
+
+ <class name="Order" table="EMBD_KM2O_ORDR">
+ <composite-id mapped="false">
+ <key-many-to-one name="customer" class="Customer"
column="CUST_ID" lazy="false"/>
+ <key-property name="number" column="ORDR_NUM"
type="long" />
+ </composite-id>
+ <set name="items" table="EMBD_KM2O_ITEM">
+ <key>
+ <column name="CUST_ID"/>
+ <column name="ORDER_NUM"/>
+ </key>
+ <element type="string" column="ITEM_DESC" />
+ </set>
+ </class>
+</hibernate-mapping>
\ No newline at end of file
Added: trunk/Hibernate3/test/org/hibernate/test/keymanytoone/bidir/embedded/Order.java
===================================================================
--- trunk/Hibernate3/test/org/hibernate/test/keymanytoone/bidir/embedded/Order.java
(rev 0)
+++
trunk/Hibernate3/test/org/hibernate/test/keymanytoone/bidir/embedded/Order.java 2007-01-23
12:54:10 UTC (rev 11076)
@@ -0,0 +1,48 @@
+package org.hibernate.test.keymanytoone.bidir.embedded;
+
+import java.util.Set;
+import java.util.HashSet;
+import java.io.Serializable;
+
+/**
+ * {@inheritDoc}
+ *
+ * @author Steve Ebersole
+ */
+public class Order implements Serializable {
+ private Customer customer;
+ private long number;
+ private Set items = new HashSet();
+
+ public Order() {
+ }
+
+ public Order(Customer customer, long number) {
+ this.customer = customer;
+ this.number = number;
+ }
+
+ public Customer getCustomer() {
+ return customer;
+ }
+
+ public void setCustomer(Customer customer) {
+ this.customer = customer;
+ }
+
+ public long getNumber() {
+ return number;
+ }
+
+ public void setNumber(long number) {
+ this.number = number;
+ }
+
+ public Set getItems() {
+ return items;
+ }
+
+ public void setItems(Set items) {
+ this.items = items;
+ }
+}