HHH-13633 : Bugs join-fetching a collection when scrolling with a stateless session using enhancement as proxy
Make corrections.
(cherry picked from commit 40a7cee13d
)
This commit is contained in:
parent
ce19b83e4e
commit
388b62f049
|
@ -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 ) {
|
||||
if ( LOG.isTraceEnabled() ) {
|
||||
LOG.trace( "Entity proxy found in session cache" );
|
||||
|
||||
final LazyInitializer li = ( (HibernateProxy) proxy ).getHibernateLazyInitializer();
|
||||
if ( li.isUnwrap() ) {
|
||||
return li.getImplementation();
|
||||
}
|
||||
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() ) {
|
||||
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() ) {
|
||||
|
|
Loading…
Reference in New Issue