mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-09 20:54:46 +00:00
HHH-7797 Corrected failing test that was exposed by src changes
This commit is contained in:
parent
41397f22d1
commit
1d5bf1608e
@ -190,6 +190,7 @@ public void testUniqueConstraint() throws Exception {
|
|||||||
int id = 5;
|
int id = 5;
|
||||||
Session s;
|
Session s;
|
||||||
Transaction tx;
|
Transaction tx;
|
||||||
|
|
||||||
s = openSession();
|
s = openSession();
|
||||||
tx = s.beginTransaction();
|
tx = s.beginTransaction();
|
||||||
Sky sky = new Sky();
|
Sky sky = new Sky();
|
||||||
@ -197,6 +198,9 @@ public void testUniqueConstraint() throws Exception {
|
|||||||
sky.color = "green";
|
sky.color = "green";
|
||||||
sky.day = "monday";
|
sky.day = "monday";
|
||||||
sky.month = "March";
|
sky.month = "March";
|
||||||
|
s.persist( sky );
|
||||||
|
tx.commit();
|
||||||
|
s.close();
|
||||||
|
|
||||||
Sky otherSky = new Sky();
|
Sky otherSky = new Sky();
|
||||||
otherSky.id = new Long( id++ );
|
otherSky.id = new Long( id++ );
|
||||||
@ -210,17 +214,25 @@ public void testUniqueConstraint() throws Exception {
|
|||||||
sameSky.day = "monday";
|
sameSky.day = "monday";
|
||||||
sameSky.month = "March";
|
sameSky.month = "March";
|
||||||
|
|
||||||
s.save( sky );
|
s = openSession();
|
||||||
s.flush();
|
tx = s.beginTransaction();
|
||||||
|
try {
|
||||||
s.save( otherSky );
|
s.persist( otherSky );
|
||||||
tx.commit();
|
tx.commit();
|
||||||
s.close();
|
fail( "unique constraints not respected" );
|
||||||
|
}
|
||||||
|
catch (HibernateException e) {
|
||||||
|
//success
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
if ( tx != null ) tx.rollback();
|
||||||
|
s.close();
|
||||||
|
}
|
||||||
|
|
||||||
s = openSession();
|
s = openSession();
|
||||||
tx = s.beginTransaction();
|
tx = s.beginTransaction();
|
||||||
try {
|
try {
|
||||||
s.save( sameSky );
|
s.persist( sameSky );
|
||||||
tx.commit();
|
tx.commit();
|
||||||
fail( "unique constraints not respected" );
|
fail( "unique constraints not respected" );
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user