From 33123d267f64298f3f40e7c3671f7f15849831a9 Mon Sep 17 00:00:00 2001 From: Sanne Grinovero Date: Tue, 17 Nov 2020 17:21:48 +0000 Subject: [PATCH] HHH-14333 Pessimistic Lock causes FOR UPDATE on outer join statements --- .../hibernate/persister/entity/AbstractEntityPersister.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java b/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java index 2891eb722a55..f0c4f6b6a531 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java @@ -4350,7 +4350,7 @@ protected void createLoaders() { if ( ! factory.getSessionFactoryOptions().isDelayBatchFetchLoaderCreationsEnabled() ) { for ( LockMode lockMode : LockMode.values() ) { //Trigger eager initialization - loaders.getOrBuildByLockMode( lockMode, this::createEntityLoader ); + getLoaderByLockMode( lockMode ); } //Also, we have two special internal fetch profiles to eagerly initialize in this case: loaders.getOrCreateByInternalFetchProfileMerge( this::buildMergeCascadeEntityLoader ); @@ -4359,7 +4359,7 @@ protected void createLoaders() { else { //At least initialize this one: it's almost certain to be used, //and also will allow to report mapping errors during initialization. - loaders.getOrBuildByLockMode( LockMode.NONE, this::createEntityLoader ); + getLoaderByLockMode( LockMode.NONE ); } } @@ -4372,7 +4372,7 @@ protected UniqueEntityLoader buildRefreshCascadeEntityLoader(LockMode ignored) { } protected final UniqueEntityLoader getLoaderByLockMode(LockMode lockMode) { - return loaders.getOrBuildByLockMode( lockMode, this::createEntityLoader ); + return loaders.getOrBuildByLockMode( lockMode, this::generateDelayedEntityLoader ); } private UniqueEntityLoader generateDelayedEntityLoader(final LockMode lockMode) {