From 51c94121cb7dfed1113239bb7c4988e0b1b79e3e Mon Sep 17 00:00:00 2001 From: Sanne Grinovero Date: Wed, 31 Jul 2019 10:30:58 +0100 Subject: [PATCH] HHH-13526 Avoid repeated lookups for the same component --- .../exec/internal/AbstractLoadPlanBasedLoader.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/loader/plan/exec/internal/AbstractLoadPlanBasedLoader.java b/hibernate-core/src/main/java/org/hibernate/loader/plan/exec/internal/AbstractLoadPlanBasedLoader.java index 939fe35df6..9720f31ffe 100644 --- a/hibernate-core/src/main/java/org/hibernate/loader/plan/exec/internal/AbstractLoadPlanBasedLoader.java +++ b/hibernate-core/src/main/java/org/hibernate/loader/plan/exec/internal/AbstractLoadPlanBasedLoader.java @@ -24,6 +24,7 @@ import org.hibernate.dialect.pagination.LimitHandler; import org.hibernate.dialect.pagination.LimitHelper; import org.hibernate.dialect.pagination.NoopLimitHandler; import org.hibernate.engine.jdbc.ColumnNameCache; +import org.hibernate.engine.jdbc.spi.JdbcCoordinator; import org.hibernate.engine.jdbc.spi.JdbcServices; import org.hibernate.engine.jdbc.spi.ResultSetWrapper; import org.hibernate.engine.spi.PersistenceContext; @@ -37,6 +38,7 @@ import org.hibernate.internal.CoreMessageLogger; import org.hibernate.loader.plan.exec.query.spi.NamedParameterContext; import org.hibernate.loader.plan.exec.spi.LoadQueryDetails; import org.hibernate.loader.spi.AfterLoadAction; +import org.hibernate.resource.jdbc.ResourceRegistry; import org.hibernate.transform.ResultTransformer; import org.hibernate.type.Type; @@ -137,12 +139,14 @@ public abstract class AbstractLoadPlanBasedLoader { } finally { if ( wrapper != null ) { - session.getJdbcCoordinator().getResourceRegistry().release( + final JdbcCoordinator jdbcCoordinator = session.getJdbcCoordinator(); + final ResourceRegistry resourceRegistry = jdbcCoordinator.getResourceRegistry(); + resourceRegistry.release( wrapper.getResultSet(), wrapper.getStatement() ); - session.getJdbcCoordinator().getResourceRegistry().release( wrapper.getStatement() ); - session.getJdbcCoordinator().afterStatementExecution(); + resourceRegistry.release( wrapper.getStatement() ); + jdbcCoordinator.afterStatementExecution(); } persistenceContext.afterLoad(); }