HHH-18469 Use collection element table group when resolving circular bidirectional fetch

This commit is contained in:
Marco Belladelli 2024-08-13 10:59:31 +02:00
parent e1baabbded
commit 6573212b75
1 changed files with 1 additions and 8 deletions

View File

@ -1334,14 +1334,7 @@ public class ToOneAttributeMapping
// We get here is this is a lazy collection initialization for which we know the owner is in the PC
// So we create a delayed fetch, as we are sure to find the entity in the PC
final FromClauseAccess fromClauseAccess = creationState.getSqlAstCreationState().getFromClauseAccess();
final NavigablePath realParent;
if ( CollectionPart.Nature.fromNameExact( parentNavigablePath.getLocalName() ) != null ) {
realParent = parentNavigablePath.getParent();
}
else {
realParent = parentNavigablePath;
}
final TableGroup parentTableGroup = fromClauseAccess.getTableGroup( realParent );
final TableGroup parentTableGroup = fromClauseAccess.getTableGroup( parentNavigablePath );
final DomainResult<?> domainResult;
if ( sideNature == ForeignKeyDescriptor.Nature.KEY ) {
domainResult = foreignKeyDescriptor.createKeyDomainResult(