HHH-7797 Corrected failing test that was exposed by src changes

This commit is contained in:
brmeyer 2012-12-17 14:10:05 -05:00 committed by Brett Meyer
parent e629feee8a
commit 29ae3debc6
1 changed files with 19 additions and 7 deletions

View File

@ -190,6 +190,7 @@ public class EntityTest extends BaseCoreFunctionalTestCase {
int id = 5;
Session s;
Transaction tx;
s = openSession();
tx = s.beginTransaction();
Sky sky = new Sky();
@ -197,6 +198,9 @@ public class EntityTest extends BaseCoreFunctionalTestCase {
sky.color = "green";
sky.day = "monday";
sky.month = "March";
s.persist( sky );
tx.commit();
s.close();
Sky otherSky = new Sky();
otherSky.id = new Long( id++ );
@ -210,17 +214,25 @@ public class EntityTest extends BaseCoreFunctionalTestCase {
sameSky.day = "monday";
sameSky.month = "March";
s.save( sky );
s.flush();
s.save( otherSky );
tx.commit();
s.close();
s = openSession();
tx = s.beginTransaction();
try {
s.persist( otherSky );
tx.commit();
fail( "unique constraints not respected" );
}
catch (HibernateException e) {
//success
}
finally {
if ( tx != null ) tx.rollback();
s.close();
}
s = openSession();
tx = s.beginTransaction();
try {
s.save( sameSky );
s.persist( sameSky );
tx.commit();
fail( "unique constraints not respected" );
}