HHH-17193 Create id initializers when containing nested collections

This commit is contained in:
Marco Belladelli 2023-10-04 11:35:46 +02:00 committed by Christian Beikov
parent 02706c7037
commit bc0afec791
1 changed files with 4 additions and 3 deletions

View File

@ -43,12 +43,13 @@ public abstract class AbstractEntityResultGraphNode extends AbstractFetchParent
final TableGroup entityTableGroup = creationState.getSqlAstCreationState().getFromClauseAccess()
.getTableGroup( navigablePath );
final EntityResultGraphNode entityResultGraphNode = (EntityResultGraphNode) fetchParent;
if ( navigablePath.getParent() == null && !creationState.forceIdentifierSelection() ) {
final Fetch fetch = creationState.visitIdentifierFetch( entityResultGraphNode );
if ( navigablePath.getParent() == null && !creationState.forceIdentifierSelection() &&
( !( fetch instanceof FetchParent ) || !( (FetchParent) fetch ).containsCollectionFetches() ) ) {
identifierFetch = null;
creationState.visitIdentifierFetch( entityResultGraphNode );
}
else {
identifierFetch = creationState.visitIdentifierFetch( entityResultGraphNode );
identifierFetch = fetch;
}
discriminatorFetch = creationState.visitDiscriminatorFetch( entityResultGraphNode );