HHH-14471 Fix concurrency issue due to builder sharing in DynamicBatchingEntityLoader
This commit is contained in:
parent
30dc9add99
commit
c1a7a14d1c
|
@ -27,7 +27,7 @@ public class DynamicBatchingEntityLoader extends BatchingEntityLoader {
|
||||||
private static final Logger log = Logger.getLogger( DynamicBatchingEntityLoader.class );
|
private static final Logger log = Logger.getLogger( DynamicBatchingEntityLoader.class );
|
||||||
|
|
||||||
private final int maxBatchSize;
|
private final int maxBatchSize;
|
||||||
private final EntityLoader.Builder entityLoaderBuilder;
|
private final LoadQueryInfluencers loadQueryInfluencers;
|
||||||
|
|
||||||
public DynamicBatchingEntityLoader(
|
public DynamicBatchingEntityLoader(
|
||||||
OuterJoinLoadable persister,
|
OuterJoinLoadable persister,
|
||||||
|
@ -37,10 +37,7 @@ public class DynamicBatchingEntityLoader extends BatchingEntityLoader {
|
||||||
LoadQueryInfluencers loadQueryInfluencers) {
|
LoadQueryInfluencers loadQueryInfluencers) {
|
||||||
super( persister );
|
super( persister );
|
||||||
this.maxBatchSize = maxBatchSize;
|
this.maxBatchSize = maxBatchSize;
|
||||||
|
this.loadQueryInfluencers = loadQueryInfluencers;
|
||||||
entityLoaderBuilder = EntityLoader.forEntity( persister )
|
|
||||||
.withInfluencers( loadQueryInfluencers )
|
|
||||||
.withLockOptions( lockOptions );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -67,7 +64,12 @@ public class DynamicBatchingEntityLoader extends BatchingEntityLoader {
|
||||||
log.debugf( "Batch loading entity: %s", MessageHelper.infoString( persister(), idsToLoad, session.getFactory() ) );
|
log.debugf( "Batch loading entity: %s", MessageHelper.infoString( persister(), idsToLoad, session.getFactory() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
final EntityLoader dynamicLoader = entityLoaderBuilder.withBatchSize( idsToLoad.length ).byPrimaryKey();
|
|
||||||
|
final EntityLoader dynamicLoader = EntityLoader.forEntity( (OuterJoinLoadable) persister() )
|
||||||
|
.withInfluencers( loadQueryInfluencers )
|
||||||
|
.withLockOptions( lockOptions )
|
||||||
|
.withBatchSize( idsToLoad.length )
|
||||||
|
.byPrimaryKey();
|
||||||
|
|
||||||
final List<?> results = dynamicLoader.loadEntityBatch(
|
final List<?> results = dynamicLoader.loadEntityBatch(
|
||||||
session,
|
session,
|
||||||
|
|
Loading…
Reference in New Issue