HHH-13526 Avoid repeated lookups for the same component

This commit is contained in:
Sanne Grinovero 2019-07-31 10:30:58 +01:00 committed by Sanne Grinovero
parent 68b1b650e9
commit 51c94121cb
1 changed files with 7 additions and 3 deletions

View File

@ -24,6 +24,7 @@ import org.hibernate.dialect.pagination.LimitHandler;
import org.hibernate.dialect.pagination.LimitHelper; import org.hibernate.dialect.pagination.LimitHelper;
import org.hibernate.dialect.pagination.NoopLimitHandler; import org.hibernate.dialect.pagination.NoopLimitHandler;
import org.hibernate.engine.jdbc.ColumnNameCache; 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.JdbcServices;
import org.hibernate.engine.jdbc.spi.ResultSetWrapper; import org.hibernate.engine.jdbc.spi.ResultSetWrapper;
import org.hibernate.engine.spi.PersistenceContext; 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.query.spi.NamedParameterContext;
import org.hibernate.loader.plan.exec.spi.LoadQueryDetails; import org.hibernate.loader.plan.exec.spi.LoadQueryDetails;
import org.hibernate.loader.spi.AfterLoadAction; import org.hibernate.loader.spi.AfterLoadAction;
import org.hibernate.resource.jdbc.ResourceRegistry;
import org.hibernate.transform.ResultTransformer; import org.hibernate.transform.ResultTransformer;
import org.hibernate.type.Type; import org.hibernate.type.Type;
@ -137,12 +139,14 @@ public abstract class AbstractLoadPlanBasedLoader {
} }
finally { finally {
if ( wrapper != null ) { if ( wrapper != null ) {
session.getJdbcCoordinator().getResourceRegistry().release( final JdbcCoordinator jdbcCoordinator = session.getJdbcCoordinator();
final ResourceRegistry resourceRegistry = jdbcCoordinator.getResourceRegistry();
resourceRegistry.release(
wrapper.getResultSet(), wrapper.getResultSet(),
wrapper.getStatement() wrapper.getStatement()
); );
session.getJdbcCoordinator().getResourceRegistry().release( wrapper.getStatement() ); resourceRegistry.release( wrapper.getStatement() );
session.getJdbcCoordinator().afterStatementExecution(); jdbcCoordinator.afterStatementExecution();
} }
persistenceContext.afterLoad(); persistenceContext.afterLoad();
} }