23
23
*/
24
24
package org .hibernate .test .naturalid .mutable .cached ;
25
25
26
- import java .io .Serializable ;
26
+ import static org .junit .Assert .assertEquals ;
27
+ import static org .junit .Assert .assertNotNull ;
28
+ import static org .junit .Assert .assertNull ;
27
29
28
- import org . junit . Test ;
30
+ import java . io . Serializable ;
29
31
30
32
import org .hibernate .LockOptions ;
31
33
import org .hibernate .Session ;
32
34
import org .hibernate .cfg .Configuration ;
33
35
import org .hibernate .cfg .Environment ;
34
- import org .hibernate .testing .junit4 .BaseCoreFunctionalTestCase ;
35
- import org .hibernate .testing .FailureExpected ;
36
36
import org .hibernate .testing .TestForIssue ;
37
-
38
- import static org .junit .Assert .assertEquals ;
39
- import static org .junit .Assert .assertNotNull ;
40
- import static org .junit .Assert .assertNull ;
37
+ import org .hibernate .testing .junit4 .BaseCoreFunctionalTestCase ;
38
+ import org .junit .Test ;
41
39
42
40
/**
43
41
* Tests of mutable natural ids stored in second level cache
@@ -185,7 +183,6 @@ public void testNaturalIdChangeAfterResolveEntityFrom2LCache() {
185
183
}
186
184
187
185
@ Test
188
- @ FailureExpected (jiraKey = "HHH-7513" )
189
186
public void testReattachementUnmodifiedInstance () {
190
187
Session session = openSession ();
191
188
session .beginTransaction ();
@@ -197,16 +194,19 @@ public void testReattachementUnmodifiedInstance() {
197
194
b .assA = a ;
198
195
a .assB .add ( b );
199
196
session .getTransaction ().commit ();
200
- session .close ();
197
+ session .clear ();
201
198
202
- session = openSession ();
203
199
session .beginTransaction ();
204
200
session .buildLockRequest (LockOptions .NONE ).lock (b ); // HHH-7513 failure during reattachment
205
201
session .delete (b .assA );
206
202
session .delete (b );
207
203
208
204
session .getTransaction ().commit ();
209
- session .close ();
205
+ session .clear ();
206
+
207
+ // true if the re-attachment worked
208
+ assertEquals ( session .createQuery ( "FROM A" ).list ().size (), 0 );
209
+ assertEquals ( session .createQuery ( "FROM B" ).list ().size (), 0 );
210
210
}
211
211
212
212
}
0 commit comments