HHH-11459 - Do not fetch a collection on cascade, resolve it instead
This commit is contained in:
parent
2779ebd8f0
commit
41bd06266d
|
@ -12,6 +12,7 @@ import java.util.HashSet;
|
|||
import java.util.Iterator;
|
||||
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.bytecode.enhance.spi.LazyPropertyInitializer;
|
||||
import org.hibernate.bytecode.enhance.spi.interceptor.LazyAttributeLoadingInterceptor;
|
||||
import org.hibernate.collection.spi.PersistentCollection;
|
||||
import org.hibernate.engine.spi.CascadeStyle;
|
||||
|
@ -94,8 +95,13 @@ public final class Cascade {
|
|||
|
||||
// For bytecode enhanced entities, need to fetch the attribute
|
||||
if ( hasUninitializedLazyProperties && persister.getPropertyLaziness()[i] && action.performOnLazyProperty() ) {
|
||||
LazyAttributeLoadingInterceptor interceptor = persister.getInstrumentationMetadata().extractInterceptor( parent );
|
||||
child = interceptor.fetchAttribute( parent, propertyName );
|
||||
if ( types[i].isCollectionType() ) {
|
||||
child = types[i].resolve( LazyPropertyInitializer.UNFETCHED_PROPERTY, eventSource, parent );
|
||||
}
|
||||
else {
|
||||
LazyAttributeLoadingInterceptor interceptor = persister.getInstrumentationMetadata().extractInterceptor( parent );
|
||||
child = interceptor.fetchAttribute( parent, propertyName );
|
||||
}
|
||||
}
|
||||
else {
|
||||
child = persister.getPropertyValue( parent, i );
|
||||
|
|
Loading…
Reference in New Issue