From cce634f03b8f23ce1c3faa068eaa60da4f5e0660 Mon Sep 17 00:00:00 2001 From: Gail Badner Date: Mon, 23 Sep 2019 13:21:59 -0700 Subject: [PATCH] HHH-13633 : Bugs join-fetching a collection when scrolling with a stateless session using enhancement as proxy Minor changes suggested by Andrea. --- .../org/hibernate/internal/StatelessSessionImpl.java | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/internal/StatelessSessionImpl.java b/hibernate-core/src/main/java/org/hibernate/internal/StatelessSessionImpl.java index 12eedcfa7d..dc5f3aca8f 100755 --- a/hibernate-core/src/main/java/org/hibernate/internal/StatelessSessionImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/StatelessSessionImpl.java @@ -299,14 +299,6 @@ public class StatelessSessionImpl extends AbstractSharedSessionContract implemen // caller did not request forceful eager loading, see if we can create // some form of proxy - final boolean allowBytecodeProxy = getFactory() - .getSessionFactoryOptions() - .isEnhancementAsProxyEnabled(); - - final boolean entityHasHibernateProxyFactory = persister.getEntityMetamodel() - .getTuplizer() - .getProxyFactory() != null; - // first, check to see if we can use "bytecode proxies" final EntityMetamodel entityMetamodel = persister.getEntityMetamodel(); @@ -315,7 +307,7 @@ public class StatelessSessionImpl extends AbstractSharedSessionContract implemen // if the entity defines a HibernateProxy factory, see if there is an // existing proxy associated with the PC - and if so, use it - if ( entityHasHibernateProxyFactory ) { + if ( persister.getEntityMetamodel().getTuplizer().getProxyFactory() != null ) { final PersistenceContext persistenceContext = getPersistenceContext(); final Object proxy = persistenceContext.getProxy( entityKey ); @@ -331,7 +323,7 @@ public class StatelessSessionImpl extends AbstractSharedSessionContract implemen } // specialized handling for entities with subclasses with a HibernateProxy factory - if ( persister.getEntityMetamodel().hasSubclasses() ) { + if ( entityMetamodel.hasSubclasses() ) { // entities with subclasses that define a ProxyFactory can create // a HibernateProxy. LOG.debugf( "Creating a HibernateProxy for to-one association with subclasses to honor laziness" );