[hibernate-commits] Hibernate SVN: r18762 - core/trunk/annotations/src/test/java/org/hibernate/test/annotations/derivedidentities/e1/b2.
hibernate-commits at lists.jboss.org
hibernate-commits at lists.jboss.org
Wed Feb 10 09:35:07 EST 2010
Author: stalep
Date: 2010-02-10 09:35:07 -0500 (Wed, 10 Feb 2010)
New Revision: 18762
Modified:
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/derivedidentities/e1/b2/IdClassGeneratedValueManyToOneTest.java
Log:
[HHH-4889]
exending the test to try to replicate an error in the specj benchmark
Modified: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/derivedidentities/e1/b2/IdClassGeneratedValueManyToOneTest.java
===================================================================
--- core/trunk/annotations/src/test/java/org/hibernate/test/annotations/derivedidentities/e1/b2/IdClassGeneratedValueManyToOneTest.java 2010-02-10 08:07:10 UTC (rev 18761)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/derivedidentities/e1/b2/IdClassGeneratedValueManyToOneTest.java 2010-02-10 14:35:07 UTC (rev 18762)
@@ -30,6 +30,8 @@
import org.hibernate.Transaction;
import org.hibernate.test.annotations.TestCase;
+import org.hibernate.junit.FailureExpected;
+
/**
* A test.
*
@@ -42,10 +44,18 @@
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 @@
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<CustomerInventory> inventory = c2.getInventories();
+ List<CustomerInventory> inventory = c12.getInventories();
assertEquals( 1, inventory.size() );
assertEquals( 10, inventory.get( 0 ).getQuantity() );
@@ -74,7 +84,46 @@
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[] {
Customer.class,
More information about the hibernate-commits
mailing list