HHH-7797 Corrected failing test that was exposed by src changes
This commit is contained in:
parent
e629feee8a
commit
29ae3debc6
|
@ -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" );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue