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 {
366366 PersistentCollection persistentCollection = me .getKey ();
367367 collectionEntry .postFlush (persistentCollection );
368368 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
370370 //iter.remove(); //does not work, since the entrySet is not backed by the set
371+ persistentCollection .unsetSession ( session );
371372 persistenceContext .getCollectionEntries ()
372373 .remove (persistentCollection );
373374 }
Original file line number Diff line number Diff line change @@ -127,8 +127,8 @@ public boolean isCollectionType() {
127127 @ Override
128128 public final boolean isEqual (Object x , Object y ) {
129129 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 ) );
132132 }
133133
134134 @ Override
Original file line number Diff line number Diff line change 3131import org .hibernate .engine .spi .CollectionEntry ;
3232import org .hibernate .engine .spi .EntityEntry ;
3333import org .hibernate .engine .spi .SessionImplementor ;
34- import org .hibernate .testing .FailureExpected ;
3534import org .hibernate .testing .junit4 .BaseCoreFunctionalTestCase ;
3635
3736import java .lang .InstantiationException ;
4948public abstract class AbstractDereferencedCollectionTest extends BaseCoreFunctionalTestCase {
5049
5150 @ Test
52- @ FailureExpected ( jiraKey = "HHH-9777" )
5351 public void testMergeNullCollection () {
5452 Session s = openSession ();
5553 s .getTransaction ().begin ();
@@ -123,7 +121,6 @@ public void testMergeNullCollection() {
123121 }
124122
125123 @ Test
126- @ FailureExpected ( jiraKey = "HHH-9777" )
127124 public void testGetAndNullifyCollection () {
128125 Session s = openSession ();
129126 s .getTransaction ().begin ();
@@ -199,7 +196,7 @@ public void testGetAndNullifyCollection() {
199196 }
200197
201198 @ Test
202- @ FailureExpected ( jiraKey = "HHH-9777" )
199+ // @FailureExpected( jiraKey = "HHH-9777")
203200 public void testGetAndReplaceCollection () {
204201 Session s = openSession ();
205202 s .getTransaction ().begin ();
Original file line number Diff line number Diff line change 2323 */
2424package org .hibernate .test .collection .dereferenced ;
2525
26+ import org .junit .Test ;
27+
28+ import org .hibernate .testing .FailureExpected ;
29+
2630/**
2731 * @author Gail Badner
2832 */
@@ -32,4 +36,25 @@ public class UnversionedCascadeDereferencedCollectionTest extends AbstractDerefe
3236 protected Class <?> getCollectionOwnerClass () {
3337 return UnversionedCascadeOne .class ;
3438 }
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 2323 */
2424package org .hibernate .test .collection .dereferenced ;
2525
26+ import org .junit .Test ;
27+
28+ import org .hibernate .testing .FailureExpected ;
29+
2630/**
2731 * @author Gail Badner
2832 */
@@ -32,4 +36,25 @@ public class UnversionedNoCascadeDereferencedCollectionTest extends AbstractDere
3236 protected Class <?> getCollectionOwnerClass () {
3337 return UnversionedNoCascadeOne .class ;
3438 }
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+ }
3560}
Original file line number Diff line number Diff line change @@ -118,6 +118,7 @@ public String[] getMappings() {
118118 }
119119
120120 @ Test
121+ @ FailureExpected (jiraKey = "HHH-9777" )
121122 public void testSaveOrUpdateCopyAny () throws Exception {
122123 Session s = openSession ();
123124 s .beginTransaction ();
You can’t perform that action at this time.
0 commit comments