HHH-13633 : Bugs join-fetching a collection when scrolling with a stateless session using enhancement as proxy

Make corrections.
This commit is contained in:
Gail Badner 2019-10-14 23:33:39 -07:00 committed by gbadner
parent 7121001fd4
commit 52ceafaa87
1 changed files with 9 additions and 10 deletions

View File

@ -46,7 +46,6 @@ import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.persister.entity.OuterJoinLoadable;
import org.hibernate.pretty.MessageHelper;
import org.hibernate.proxy.HibernateProxy;
import org.hibernate.proxy.LazyInitializer;
import org.hibernate.query.spi.ScrollableResultsImplementor;
import org.hibernate.tuple.entity.EntityMetamodel;
@ -312,11 +311,11 @@ public class StatelessSessionImpl extends AbstractSharedSessionContract implemen
final Object proxy = persistenceContext.getProxy( entityKey );
if ( proxy != null ) {
LOG.trace( "Entity proxy found in session cache" );
final LazyInitializer li = ( (HibernateProxy) proxy ).getHibernateLazyInitializer();
if ( li.isUnwrap() ) {
return li.getImplementation();
if ( LOG.isTraceEnabled() ) {
LOG.trace( "Entity proxy found in session cache" );
}
if ( LOG.isDebugEnabled() && ( (HibernateProxy) proxy ).getHibernateLazyInitializer().isUnwrap() ) {
LOG.debug( "Ignoring NO_PROXY to honor laziness" );
}
return persistenceContext.narrowProxy( proxy, persister, entityKey, null );
@ -331,11 +330,11 @@ public class StatelessSessionImpl extends AbstractSharedSessionContract implemen
}
return bytecodeEnhancementMetadata.createEnhancedProxy( entityKey, false, this );
}
else {
if ( !entityMetamodel.hasSubclasses() ) {
return bytecodeEnhancementMetadata.createEnhancedProxy( entityKey, false, this );
}
else if ( !entityMetamodel.hasSubclasses() ) {
return bytecodeEnhancementMetadata.createEnhancedProxy( entityKey, false, this );
}
// If we get here, then the entity class has subclasses and there is no HibernateProxy factory.
// The entity will get loaded below.
}
else {
if ( persister.hasProxy() ) {