HHH-17130 remove restrictive instanceof EntityResultInitializer check

This commit is contained in:
Barry LaFond 2023-08-24 09:17:39 -05:00 committed by Christian Beikov
parent a8a4ff2af0
commit d108a47a7d
1 changed files with 1 additions and 22 deletions

View File

@ -150,11 +150,7 @@ public class SubselectFetch {
}
public void addKey(EntityKey key, LoadingEntityEntry entry) {
if ( !entry.getDescriptor().hasSubselectLoadableCollections() ) {
return;
}
if ( shouldAddSubselectFetch( entry ) ) {
if ( entry.getDescriptor().hasSubselectLoadableCollections() ) {
final SubselectFetch subselectFetch = subselectFetches.computeIfAbsent(
entry.getEntityInitializer().getNavigablePath(),
navigablePath -> new SubselectFetch(
@ -171,22 +167,5 @@ public class SubselectFetch {
batchFetchQueue.addSubselect( key, subselectFetch );
}
}
private boolean shouldAddSubselectFetch(LoadingEntityEntry entry) {
if ( entry.getEntityInitializer() instanceof EntityResultInitializer ) {
return true;
}
final NavigablePath entityInitializerParent = entry.getEntityInitializer().getNavigablePath().getParent();
// We want to add only the collections of the loading entities
for ( DomainResult<?> domainResult : loadingSqlAst.getDomainResultDescriptors() ) {
if ( domainResult.getNavigablePath().equals( entityInitializerParent ) ) {
return true;
}
}
return false;
}
}
}