[HHH-4889]

exending the test to try to replicate an error in the specj benchmark


git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@18762 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
Ståle W. Pedersen 2010-02-10 14:35:07 +00:00
parent 89acfc7692
commit 09d051150c
1 changed files with 54 additions and 5 deletions

View File

@ -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<CustomerInventory> inventory = c2.getInventories();
List<CustomerInventory> 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[] {