File tree Expand file tree Collapse file tree 6 files changed +57
-8
lines changed
test/java/org/hibernate/test Expand file tree Collapse file tree 6 files changed +57
-8
lines changed Original file line number Diff line number Diff line change @@ -366,8 +366,9 @@ protected void postFlush(SessionImplementor session) throws HibernateException {
366
366
PersistentCollection persistentCollection = me .getKey ();
367
367
collectionEntry .postFlush (persistentCollection );
368
368
if ( collectionEntry .getLoadedPersister () == null ) {
369
- //if the collection is dereferenced, remove from the session cache
369
+ //if the collection is dereferenced, unset its session reference and remove from the session cache
370
370
//iter.remove(); //does not work, since the entrySet is not backed by the set
371
+ persistentCollection .unsetSession ( session );
371
372
persistenceContext .getCollectionEntries ()
372
373
.remove (persistentCollection );
373
374
}
Original file line number Diff line number Diff line change @@ -127,8 +127,8 @@ public boolean isCollectionType() {
127
127
@ Override
128
128
public final boolean isEqual (Object x , Object y ) {
129
129
return x == y
130
- || ( x instanceof PersistentCollection && ( (PersistentCollection ) x ).isWrapper ( y ) )
131
- || ( y instanceof PersistentCollection && ( (PersistentCollection ) y ).isWrapper ( x ) );
130
+ || ( x instanceof PersistentCollection && ( (PersistentCollection ) x ).wasInitialized () && ( ( PersistentCollection ) x ). isWrapper ( y ) )
131
+ || ( y instanceof PersistentCollection && ( (PersistentCollection ) y ).wasInitialized () && ( ( PersistentCollection ) y ). isWrapper ( x ) );
132
132
}
133
133
134
134
@ Override
Original file line number Diff line number Diff line change 31
31
import org .hibernate .engine .spi .CollectionEntry ;
32
32
import org .hibernate .engine .spi .EntityEntry ;
33
33
import org .hibernate .engine .spi .SessionImplementor ;
34
- import org .hibernate .testing .FailureExpected ;
35
34
import org .hibernate .testing .junit4 .BaseCoreFunctionalTestCase ;
36
35
37
36
import java .lang .InstantiationException ;
49
48
public abstract class AbstractDereferencedCollectionTest extends BaseCoreFunctionalTestCase {
50
49
51
50
@ Test
52
- @ FailureExpected ( jiraKey = "HHH-9777" )
53
51
public void testMergeNullCollection () {
54
52
Session s = openSession ();
55
53
s .getTransaction ().begin ();
@@ -123,7 +121,6 @@ public void testMergeNullCollection() {
123
121
}
124
122
125
123
@ Test
126
- @ FailureExpected ( jiraKey = "HHH-9777" )
127
124
public void testGetAndNullifyCollection () {
128
125
Session s = openSession ();
129
126
s .getTransaction ().begin ();
@@ -199,7 +196,7 @@ public void testGetAndNullifyCollection() {
199
196
}
200
197
201
198
@ Test
202
- @ FailureExpected ( jiraKey = "HHH-9777" )
199
+ // @FailureExpected( jiraKey = "HHH-9777")
203
200
public void testGetAndReplaceCollection () {
204
201
Session s = openSession ();
205
202
s .getTransaction ().begin ();
Original file line number Diff line number Diff line change 23
23
*/
24
24
package org .hibernate .test .collection .dereferenced ;
25
25
26
+ import org .junit .Test ;
27
+
28
+ import org .hibernate .testing .FailureExpected ;
29
+
26
30
/**
27
31
* @author Gail Badner
28
32
*/
@@ -32,4 +36,25 @@ public class UnversionedCascadeDereferencedCollectionTest extends AbstractDerefe
32
36
protected Class <?> getCollectionOwnerClass () {
33
37
return UnversionedCascadeOne .class ;
34
38
}
35
- }
39
+
40
+ @ Override
41
+ @ Test
42
+ @ FailureExpected (jiraKey = "HHH-9777" )
43
+ public void testMergeNullCollection () {
44
+ super .testMergeNullCollection ();
45
+ }
46
+
47
+ @ Override
48
+ @ Test
49
+ @ FailureExpected (jiraKey = "HHH-9777" )
50
+ public void testGetAndNullifyCollection () {
51
+ super .testGetAndNullifyCollection ();
52
+ }
53
+
54
+ @ Override
55
+ @ Test
56
+ @ FailureExpected (jiraKey = "HHH-9777" )
57
+ public void testGetAndReplaceCollection () {
58
+ super .testGetAndReplaceCollection ();
59
+ }
60
+ }
Original file line number Diff line number Diff line change 23
23
*/
24
24
package org .hibernate .test .collection .dereferenced ;
25
25
26
+ import org .junit .Test ;
27
+
28
+ import org .hibernate .testing .FailureExpected ;
29
+
26
30
/**
27
31
* @author Gail Badner
28
32
*/
@@ -32,4 +36,25 @@ public class UnversionedNoCascadeDereferencedCollectionTest extends AbstractDere
32
36
protected Class <?> getCollectionOwnerClass () {
33
37
return UnversionedNoCascadeOne .class ;
34
38
}
39
+
40
+ @ Override
41
+ @ Test
42
+ @ FailureExpected (jiraKey = "HHH-9777" )
43
+ public void testMergeNullCollection () {
44
+ super .testMergeNullCollection ();
45
+ }
46
+
47
+ @ Override
48
+ @ Test
49
+ @ FailureExpected (jiraKey = "HHH-9777" )
50
+ public void testGetAndNullifyCollection () {
51
+ super .testGetAndNullifyCollection ();
52
+ }
53
+
54
+ @ Override
55
+ @ Test
56
+ @ FailureExpected (jiraKey = "HHH-9777" )
57
+ public void testGetAndReplaceCollection () {
58
+ super .testGetAndReplaceCollection ();
59
+ }
35
60
}
Original file line number Diff line number Diff line change @@ -118,6 +118,7 @@ public String[] getMappings() {
118
118
}
119
119
120
120
@ Test
121
+ @ FailureExpected (jiraKey = "HHH-9777" )
121
122
public void testSaveOrUpdateCopyAny () throws Exception {
122
123
Session s = openSession ();
123
124
s .beginTransaction ();
You can’t perform that action at this time.
0 commit comments