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 564eeead3c
commit dbf5d222bb
1 changed files with 1 additions and 8 deletions

View File

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