HHH-17130 remove restrictive instanceof EntityResultInitializer check
This commit is contained in:
parent
a8a4ff2af0
commit
d108a47a7d
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue