HHH-16966 StackOverFlowError with @ManyToOne and @Proxy( lazy=false )

This commit is contained in:
Andrea Boriero 2023-07-24 15:51:03 +02:00 committed by Andrea Boriero
parent 87096e5a0a
commit 0725022d79
1 changed files with 2 additions and 6 deletions

View File

@ -147,12 +147,8 @@ public class EntitySelectFetchInitializerBuilder {
}
private static boolean canBatchInitializeBeUsed(EntityPersister entityPersister) {
if ( entityPersister.getRepresentationStrategy().getProxyFactory() == null
&& entityPersister.hasSubclasses() ) {
// We cannot neither create a proxy nor instantiate the entity because we don't know the concrete type
return false;
}
return true;
// we need to create a Proxy in order to use batch initialize
return entityPersister.getRepresentationStrategy().getProxyFactory() != null;
}
enum BatchMode {