66 */
77package org .hibernate .test .annotations .filter .secondarytable ;
88
9+ import org .hibernate .Session ;
10+
911import org .hibernate .testing .junit4 .BaseCoreFunctionalTestCase ;
1012import org .junit .Assert ;
1113import 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