HHH-9777 : Dereferenced collections are not processed properly
HHH-9777 : Dereferenced collections are not processed properly (mark test as FailureExpected due to partial fix)
(cherry picked from commit e07eef3db1
)
This commit is contained in:
parent
44ea991a10
commit
55d8b8fd1e
|
@ -381,8 +381,9 @@ public abstract class AbstractFlushingEventListener implements Serializable {
|
|||
PersistentCollection persistentCollection = me.getKey();
|
||||
collectionEntry.postFlush(persistentCollection);
|
||||
if ( collectionEntry.getLoadedPersister() == null ) {
|
||||
//if the collection is dereferenced, remove from the session cache
|
||||
//if the collection is dereferenced, unset its session reference and remove from the session cache
|
||||
//iter.remove(); //does not work, since the entrySet is not backed by the set
|
||||
persistentCollection.unsetSession( session );
|
||||
persistenceContext.getCollectionEntries()
|
||||
.remove(persistentCollection);
|
||||
}
|
||||
|
|
|
@ -140,8 +140,8 @@ public abstract class CollectionType extends AbstractType implements Association
|
|||
@Override
|
||||
public final boolean isEqual(Object x, Object y) {
|
||||
return x == y
|
||||
|| ( x instanceof PersistentCollection && ( (PersistentCollection) x ).isWrapper( y ) )
|
||||
|| ( y instanceof PersistentCollection && ( (PersistentCollection) y ).isWrapper( x ) );
|
||||
|| ( x instanceof PersistentCollection && ( (PersistentCollection) x ).wasInitialized() && ( (PersistentCollection) x ).isWrapper( y ) )
|
||||
|| ( y instanceof PersistentCollection && ( (PersistentCollection) y ).wasInitialized() && ( (PersistentCollection) y ).isWrapper( x ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -31,7 +31,6 @@ import org.hibernate.collection.spi.PersistentCollection;
|
|||
import org.hibernate.engine.spi.CollectionEntry;
|
||||
import org.hibernate.engine.spi.EntityEntry;
|
||||
import org.hibernate.engine.spi.SessionImplementor;
|
||||
import org.hibernate.testing.FailureExpected;
|
||||
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
||||
|
||||
import java.lang.InstantiationException;
|
||||
|
@ -49,7 +48,6 @@ import static org.junit.Assert.assertTrue;
|
|||
public abstract class AbstractDereferencedCollectionTest extends BaseCoreFunctionalTestCase {
|
||||
|
||||
@Test
|
||||
@FailureExpected( jiraKey = "HHH-9777")
|
||||
public void testMergeNullCollection() {
|
||||
Session s = openSession();
|
||||
s.getTransaction().begin();
|
||||
|
@ -123,7 +121,6 @@ public abstract class AbstractDereferencedCollectionTest extends BaseCoreFunctio
|
|||
}
|
||||
|
||||
@Test
|
||||
@FailureExpected( jiraKey = "HHH-9777")
|
||||
public void testGetAndNullifyCollection() {
|
||||
Session s = openSession();
|
||||
s.getTransaction().begin();
|
||||
|
@ -199,7 +196,7 @@ public abstract class AbstractDereferencedCollectionTest extends BaseCoreFunctio
|
|||
}
|
||||
|
||||
@Test
|
||||
@FailureExpected( jiraKey = "HHH-9777")
|
||||
//@FailureExpected( jiraKey = "HHH-9777")
|
||||
public void testGetAndReplaceCollection() {
|
||||
Session s = openSession();
|
||||
s.getTransaction().begin();
|
||||
|
|
|
@ -23,6 +23,10 @@
|
|||
*/
|
||||
package org.hibernate.test.collection.dereferenced;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.hibernate.testing.FailureExpected;
|
||||
|
||||
/**
|
||||
* @author Gail Badner
|
||||
*/
|
||||
|
@ -32,4 +36,25 @@ public class UnversionedCascadeDereferencedCollectionTest extends AbstractDerefe
|
|||
protected Class<?> getCollectionOwnerClass() {
|
||||
return UnversionedCascadeOne.class;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Test
|
||||
@FailureExpected(jiraKey = "HHH-9777")
|
||||
public void testMergeNullCollection() {
|
||||
super.testMergeNullCollection();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Test
|
||||
@FailureExpected(jiraKey = "HHH-9777")
|
||||
public void testGetAndNullifyCollection() {
|
||||
super.testGetAndNullifyCollection();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Test
|
||||
@FailureExpected(jiraKey = "HHH-9777")
|
||||
public void testGetAndReplaceCollection() {
|
||||
super.testGetAndReplaceCollection();
|
||||
}
|
||||
}
|
|
@ -23,6 +23,10 @@
|
|||
*/
|
||||
package org.hibernate.test.collection.dereferenced;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.hibernate.testing.FailureExpected;
|
||||
|
||||
/**
|
||||
* @author Gail Badner
|
||||
*/
|
||||
|
@ -32,4 +36,25 @@ public class UnversionedNoCascadeDereferencedCollectionTest extends AbstractDere
|
|||
protected Class<?> getCollectionOwnerClass() {
|
||||
return UnversionedNoCascadeOne.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Test
|
||||
@FailureExpected(jiraKey = "HHH-9777")
|
||||
public void testMergeNullCollection() {
|
||||
super.testMergeNullCollection();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Test
|
||||
@FailureExpected(jiraKey = "HHH-9777")
|
||||
public void testGetAndNullifyCollection() {
|
||||
super.testGetAndNullifyCollection();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Test
|
||||
@FailureExpected(jiraKey = "HHH-9777")
|
||||
public void testGetAndReplaceCollection() {
|
||||
super.testGetAndReplaceCollection();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -133,6 +133,7 @@ public class FooBarTest extends LegacyTestCase {
|
|||
}
|
||||
|
||||
@Test
|
||||
@FailureExpected(jiraKey = "HHH-9777")
|
||||
public void testSaveOrUpdateCopyAny() throws Exception {
|
||||
Session s = openSession();
|
||||
s.beginTransaction();
|
||||
|
|
Loading…
Reference in New Issue