@@ -57,10 +57,9 @@ public EntityBatchLoaderInPredicate(
5757 int idColumnCount =
5858 entityDescriptor .getEntityPersister ().getIdentifierType ()
5959 .getColumnSpan ( sessionFactory .getRuntimeMetamodels ());
60- this .sqlBatchSize = sessionFactory .getJdbcServices ()
61- .getDialect ()
62- .getBatchLoadSizingStrategy ()
63- .determineOptimalBatchLoadSize ( idColumnCount , domainBatchSize , false );
60+ this .sqlBatchSize =
61+ sessionFactory .getJdbcServices ().getDialect ().getBatchLoadSizingStrategy ()
62+ .determineOptimalBatchLoadSize ( idColumnCount , domainBatchSize , false );
6463
6564 if ( MULTI_KEY_LOAD_LOGGER .isDebugEnabled () ) {
6665 MULTI_KEY_LOAD_LOGGER .debugf (
@@ -128,10 +127,11 @@ protected void initializeEntities(
128127 MULTI_KEY_LOAD_LOGGER .debugf ( "Ids to batch-fetch initialize (`%s#%s`) %s" ,
129128 getLoadable ().getEntityName (), pkValue , Arrays .toString (idsToInitialize ) );
130129 }
130+ final EntityIdentifierMapping identifierMapping = getLoadable ().getIdentifierMapping ();
131131 final MultiKeyLoadChunker <Object > chunker = new MultiKeyLoadChunker <>(
132132 sqlBatchSize ,
133- getLoadable (). getIdentifierMapping () .getJdbcTypeCount (),
134- getLoadable (). getIdentifierMapping () ,
133+ identifierMapping .getJdbcTypeCount (),
134+ identifierMapping ,
135135 jdbcParameters ,
136136 sqlAst ,
137137 jdbcSelectOperation
@@ -145,19 +145,18 @@ protected void initializeEntities(
145145 sqlBatchSize ,
146146 (jdbcParameterBindings , session1 ) -> {
147147 // Create a RegistrationHandler for handling any subselect fetches we encounter handling this chunk
148- final SubselectFetch .RegistrationHandler registrationHandler = SubselectFetch .createRegistrationHandler (
149- batchFetchQueue ,
150- sqlAst ,
151- jdbcParameters ,
152- jdbcParameterBindings
153- );
154148 return new SingleIdExecutionContext (
155149 pkValue ,
156150 entityInstance ,
157151 getLoadable ().getRootEntityDescriptor (),
158152 readOnly ,
159153 lockOptions ,
160- registrationHandler ,
154+ SubselectFetch .createRegistrationHandler (
155+ batchFetchQueue ,
156+ sqlAst ,
157+ jdbcParameters ,
158+ jdbcParameterBindings
159+ ),
161160 session
162161 );
163162 },
0 commit comments