HHH-11576 - Process unfetched collections on Flushvisitor to determine reachability

This commit is contained in:
barreiro 2017-03-18 02:58:24 +00:00 committed by Gail Badner
parent 8f495505e5
commit a5c7087316

View File

@ -7,6 +7,7 @@
package org.hibernate.event.internal; package org.hibernate.event.internal;
import org.hibernate.HibernateException; import org.hibernate.HibernateException;
import org.hibernate.bytecode.enhance.spi.LazyPropertyInitializer;
import org.hibernate.collection.spi.PersistentCollection; import org.hibernate.collection.spi.PersistentCollection;
import org.hibernate.engine.internal.Collections; import org.hibernate.engine.internal.Collections;
import org.hibernate.event.spi.EventSource; import org.hibernate.event.spi.EventSource;
@ -35,6 +36,9 @@ Object processCollection(Object collection, CollectionType type)
if ( type.hasHolder() ) { if ( type.hasHolder() ) {
coll = getSession().getPersistenceContext().getCollectionHolder(collection); coll = getSession().getPersistenceContext().getCollectionHolder(collection);
} }
else if ( collection == LazyPropertyInitializer.UNFETCHED_PROPERTY ) {
coll = (PersistentCollection) type.resolve( collection, getSession(), owner );
}
else { else {
coll = (PersistentCollection) collection; coll = (PersistentCollection) collection;
} }
@ -46,6 +50,11 @@ Object processCollection(Object collection, CollectionType type)
} }
@Override
boolean includeEntityProperty(Object[] values, int i) {
return true;
}
FlushVisitor(EventSource session, Object owner) { FlushVisitor(EventSource session, Object owner) {
super(session); super(session);
this.owner = owner; this.owner = owner;