diff --git a/annotations/src/test/java/org/hibernate/test/annotations/derivedidentities/e1/b2/IdClassGeneratedValueManyToOneTest.java b/annotations/src/test/java/org/hibernate/test/annotations/derivedidentities/e1/b2/IdClassGeneratedValueManyToOneTest.java index 636f827ca2..abc3b8306c 100755 --- a/annotations/src/test/java/org/hibernate/test/annotations/derivedidentities/e1/b2/IdClassGeneratedValueManyToOneTest.java +++ b/annotations/src/test/java/org/hibernate/test/annotations/derivedidentities/e1/b2/IdClassGeneratedValueManyToOneTest.java @@ -30,6 +30,8 @@ import org.hibernate.Session; import org.hibernate.Transaction; import org.hibernate.test.annotations.TestCase; +import org.hibernate.junit.FailureExpected; + /** * A test. * @@ -42,10 +44,18 @@ public class IdClassGeneratedValueManyToOneTest extends TestCase { Transaction tx = s.beginTransaction(); Customer c1 = new Customer( - "foo", "bar", "contact1", "100", new BigDecimal( 1000 ), new BigDecimal( 1000 ), new BigDecimal( 1000 ) - ); - + "foo", "bar", "contact1", "100", new BigDecimal( 1000 ), new BigDecimal( 1000 ), new BigDecimal( 1000 )); s.persist( c1 ); + s.flush(); + s.clear(); + +// why does this cause a failure? +// Customer c2 = new Customer( +// "foo1", "bar1", "contact2", "200", new BigDecimal( 2000 ), new BigDecimal( 2000 ), new BigDecimal( 2000 )); +// s.persist( c2 ); +// s.flush(); +// s.clear(); + Item boat = new Item(); boat.setId( "1" ); boat.setName( "cruiser" ); @@ -62,9 +72,9 @@ public class IdClassGeneratedValueManyToOneTest extends TestCase { s.flush(); s.clear(); - Customer c2 = ( Customer ) s.createQuery( "select c from Customer c" ).uniqueResult(); + Customer c12 = ( Customer ) s.createQuery( "select c from Customer c" ).uniqueResult(); - List inventory = c2.getInventories(); + List inventory = c12.getInventories(); assertEquals( 1, inventory.size() ); assertEquals( 10, inventory.get( 0 ).getQuantity() ); @@ -74,6 +84,45 @@ public class IdClassGeneratedValueManyToOneTest extends TestCase { assertTrue( true ); } + + /* + public void testCustomer() + { + Session s = openSession(); + Transaction tx = s.beginTransaction(); + for(int i=0; i < 2; i++) + { + Customer c1 = new Customer( + "foo"+i, "bar"+i, "contact"+i, "100", new BigDecimal( 1000+i ), new BigDecimal( 1000+i ), new BigDecimal( 1000+i ) + ); + s.persist( c1 ); + s.flush(); + s.clear(); + + Item boat = new Item(); + boat.setId( Integer.toString(i) ); + boat.setName( "cruiser" ); + boat.setPrice( new BigDecimal( 500 ) ); + boat.setDescription( "a boat" ); + boat.setCategory( 42 ); + + s.persist( boat ); + s.flush(); + s.clear(); + + c1.addInventory( boat, 10, new BigDecimal( 5000 ) ); + s.merge( c1 ); + + s.flush(); + s.clear(); + } + + tx.rollback(); + s.close(); + + assertTrue( true ); + + }*/ protected Class[] getAnnotatedClasses() { return new Class[] {