Skip to content

Commit 38e487f

Browse files
dreab8sebersole
authored andcommitted
Fix SecondaryTableTest
1 parent 6720d75 commit 38e487f

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

hibernate-core/src/test/java/org/hibernate/test/annotations/filter/secondarytable/SecondaryTableTest.java

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
*/
77
package org.hibernate.test.annotations.filter.secondarytable;
88

9+
import org.hibernate.Session;
10+
911
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
1012
import org.junit.Assert;
1113
import org.junit.Test;
@@ -19,12 +21,18 @@ protected Class<?>[] getAnnotatedClasses() {
1921

2022
@Override
2123
protected void prepareTest() throws Exception {
22-
openSession();
23-
insertUser("[email protected]", 21, false, "a1", "b");
24-
insertUser("[email protected]", 22, false, "a2", "b");
25-
insertUser("[email protected]", 23, true, "a3", "b");
26-
insertUser("[email protected]", 24, false, "a4", "b");
27-
session.flush();
24+
Session s = openSession();
25+
s.beginTransaction();
26+
try {
27+
insertUser( "[email protected]", 21, false, "a1", "b" );
28+
insertUser( "[email protected]", 22, false, "a2", "b" );
29+
insertUser( "[email protected]", 23, true, "a3", "b" );
30+
insertUser( "[email protected]", 24, false, "a4", "b" );
31+
session.flush();
32+
s.getTransaction().commit();
33+
}catch (Exception e){
34+
s.getTransaction().rollback();
35+
}
2836
}
2937

3038
@Test

0 commit comments

Comments
 (0)