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
ab1f1c0135
commit
98743e3096
|
@ -380,8 +380,9 @@ public abstract class AbstractFlushingEventListener implements Serializable {
|
||||||
PersistentCollection persistentCollection = me.getKey();
|
PersistentCollection persistentCollection = me.getKey();
|
||||||
collectionEntry.postFlush(persistentCollection);
|
collectionEntry.postFlush(persistentCollection);
|
||||||
if ( collectionEntry.getLoadedPersister() == null ) {
|
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
|
//iter.remove(); //does not work, since the entrySet is not backed by the set
|
||||||
|
persistentCollection.unsetSession( session );
|
||||||
persistenceContext.getCollectionEntries()
|
persistenceContext.getCollectionEntries()
|
||||||
.remove(persistentCollection);
|
.remove(persistentCollection);
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,8 +134,8 @@ public abstract class CollectionType extends AbstractType implements Association
|
||||||
|
|
||||||
public final boolean isEqual(Object x, Object y) {
|
public final boolean isEqual(Object x, Object y) {
|
||||||
return x == y
|
return x == y
|
||||||
|| ( x instanceof PersistentCollection && ( (PersistentCollection) x ).isWrapper( y ) )
|
|| ( x instanceof PersistentCollection && ( (PersistentCollection) x ).wasInitialized() && ( (PersistentCollection) x ).isWrapper( y ) )
|
||||||
|| ( y instanceof PersistentCollection && ( (PersistentCollection) y ).isWrapper( x ) );
|
|| ( y instanceof PersistentCollection && ( (PersistentCollection) y ).wasInitialized() && ( (PersistentCollection) y ).isWrapper( x ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
public int compare(Object x, Object y) {
|
public int compare(Object x, Object y) {
|
||||||
|
|
|
@ -31,7 +31,6 @@ import org.hibernate.collection.spi.PersistentCollection;
|
||||||
import org.hibernate.engine.spi.CollectionEntry;
|
import org.hibernate.engine.spi.CollectionEntry;
|
||||||
import org.hibernate.engine.spi.EntityEntry;
|
import org.hibernate.engine.spi.EntityEntry;
|
||||||
import org.hibernate.engine.spi.SessionImplementor;
|
import org.hibernate.engine.spi.SessionImplementor;
|
||||||
import org.hibernate.testing.FailureExpected;
|
|
||||||
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
||||||
|
|
||||||
import java.lang.InstantiationException;
|
import java.lang.InstantiationException;
|
||||||
|
@ -49,7 +48,6 @@ import static org.junit.Assert.assertTrue;
|
||||||
public abstract class AbstractDereferencedCollectionTest extends BaseCoreFunctionalTestCase {
|
public abstract class AbstractDereferencedCollectionTest extends BaseCoreFunctionalTestCase {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@FailureExpected( jiraKey = "HHH-9777")
|
|
||||||
public void testMergeNullCollection() {
|
public void testMergeNullCollection() {
|
||||||
Session s = openSession();
|
Session s = openSession();
|
||||||
s.getTransaction().begin();
|
s.getTransaction().begin();
|
||||||
|
@ -123,7 +121,6 @@ public abstract class AbstractDereferencedCollectionTest extends BaseCoreFunctio
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@FailureExpected( jiraKey = "HHH-9777")
|
|
||||||
public void testGetAndNullifyCollection() {
|
public void testGetAndNullifyCollection() {
|
||||||
Session s = openSession();
|
Session s = openSession();
|
||||||
s.getTransaction().begin();
|
s.getTransaction().begin();
|
||||||
|
@ -199,7 +196,7 @@ public abstract class AbstractDereferencedCollectionTest extends BaseCoreFunctio
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@FailureExpected( jiraKey = "HHH-9777")
|
//@FailureExpected( jiraKey = "HHH-9777")
|
||||||
public void testGetAndReplaceCollection() {
|
public void testGetAndReplaceCollection() {
|
||||||
Session s = openSession();
|
Session s = openSession();
|
||||||
s.getTransaction().begin();
|
s.getTransaction().begin();
|
||||||
|
|
|
@ -23,6 +23,10 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.collection.dereferenced;
|
package org.hibernate.test.collection.dereferenced;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import org.hibernate.testing.FailureExpected;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Gail Badner
|
* @author Gail Badner
|
||||||
*/
|
*/
|
||||||
|
@ -32,4 +36,25 @@ public class UnversionedCascadeDereferencedCollectionTest extends AbstractDerefe
|
||||||
protected Class<?> getCollectionOwnerClass() {
|
protected Class<?> getCollectionOwnerClass() {
|
||||||
return UnversionedCascadeOne.class;
|
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;
|
package org.hibernate.test.collection.dereferenced;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import org.hibernate.testing.FailureExpected;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Gail Badner
|
* @author Gail Badner
|
||||||
*/
|
*/
|
||||||
|
@ -32,4 +36,25 @@ public class UnversionedNoCascadeDereferencedCollectionTest extends AbstractDere
|
||||||
protected Class<?> getCollectionOwnerClass() {
|
protected Class<?> getCollectionOwnerClass() {
|
||||||
return UnversionedNoCascadeOne.class;
|
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 class FooBarTest extends LegacyTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@FailureExpected(jiraKey = "HHH-9777")
|
||||||
public void testSaveOrUpdateCopyAny() throws Exception {
|
public void testSaveOrUpdateCopyAny() throws Exception {
|
||||||
Session s = openSession();
|
Session s = openSession();
|
||||||
s.beginTransaction();
|
s.beginTransaction();
|
||||||
|
|
Loading…
Reference in New Issue