mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-27 14:30:16 +00:00
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 e07eef3db19f1f9de04e846b3a0e6852a2312cd8)
This commit is contained in:
parent
ab1f1c0135
commit
98743e3096
@ -380,8 +380,9 @@ protected void postFlush(SessionImplementor session) throws HibernateException {
|
||||
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);
|
||||
}
|
||||
|
@ -134,8 +134,8 @@ public boolean isCollectionType() {
|
||||
|
||||
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 ) );
|
||||
}
|
||||
|
||||
public int compare(Object x, Object y) {
|
||||
|
@ -31,7 +31,6 @@
|
||||
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 @@
|
||||
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 void testMergeNullCollection() {
|
||||
}
|
||||
|
||||
@Test
|
||||
@FailureExpected( jiraKey = "HHH-9777")
|
||||
public void testGetAndNullifyCollection() {
|
||||
Session s = openSession();
|
||||
s.getTransaction().begin();
|
||||
@ -199,7 +196,7 @@ public void testGetAndNullifyCollection() {
|
||||
}
|
||||
|
||||
@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();
|
||||
}
|
||||
}
|
||||
|
@ -130,6 +130,7 @@ public String[] getMappings() {
|
||||
}
|
||||
|
||||
@Test
|
||||
@FailureExpected(jiraKey = "HHH-9777")
|
||||
public void testSaveOrUpdateCopyAny() throws Exception {
|
||||
Session s = openSession();
|
||||
s.beginTransaction();
|
||||
|
Loading…
x
Reference in New Issue
Block a user