HHH-16209 Identically-named association in entity root and embeddable leads to mixup during association loading

This commit is contained in:
Andrea Boriero 2023-02-28 10:12:02 +01:00
parent f728b380a3
commit 6ed48ffff5
1 changed files with 4 additions and 1 deletions

View File

@ -1068,7 +1068,10 @@ public class ToOneAttributeMapping
NavigablePath navigablePath = parentNavigablePath.trimSuffix( bidirectionalAttributePath );
if ( navigablePath != null ) {
if ( navigablePath.getLocalName().equals( EntityIdentifierMapping.ROLE_LOCAL_NAME ) ) {
final String localName = navigablePath.getLocalName();
if ( localName.equals( EntityIdentifierMapping.ROLE_LOCAL_NAME )
|| localName.equals( ForeignKeyDescriptor.PART_NAME )
|| localName.equals( ForeignKeyDescriptor.TARGET_PART_NAME ) ) {
navigablePath = navigablePath.getParent();
}
return creationState.resolveModelPart( navigablePath ).getPartMappingType() == entityMappingType;