HHH-16209 Identically-named association in entity root and embeddable leads to mixup during association loading
This commit is contained in:
parent
5e82db1caa
commit
f728b380a3
|
@ -1065,7 +1065,15 @@ public class ToOneAttributeMapping
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return parentNavigablePath.isSuffix( bidirectionalAttributePath );
|
|
||||||
|
NavigablePath navigablePath = parentNavigablePath.trimSuffix( bidirectionalAttributePath );
|
||||||
|
if ( navigablePath != null ) {
|
||||||
|
if ( navigablePath.getLocalName().equals( EntityIdentifierMapping.ROLE_LOCAL_NAME ) ) {
|
||||||
|
navigablePath = navigablePath.getParent();
|
||||||
|
}
|
||||||
|
return creationState.resolveModelPart( navigablePath ).getPartMappingType() == entityMappingType;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isParentEmbeddedCollectionPart(DomainResultCreationState creationState, NavigablePath parentNavigablePath) {
|
private boolean isParentEmbeddedCollectionPart(DomainResultCreationState creationState, NavigablePath parentNavigablePath) {
|
||||||
|
|
|
@ -205,6 +205,30 @@ public class NavigablePath implements DotIdentifierSequence, Serializable {
|
||||||
return getParent() != null && getParent().isSuffix( dotIdentifierSequence.getParent() );
|
return getParent() != null && getParent().isSuffix( dotIdentifierSequence.getParent() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Removes the suffix part from the NavigablePath,
|
||||||
|
* when the NavigablePath does not contain the suffix it returns null;
|
||||||
|
*
|
||||||
|
* @param suffix the part to remove from the NavigablePath
|
||||||
|
*
|
||||||
|
* @return the NavigablePath stripped of the suffix part
|
||||||
|
* or null if the NavigablePath does not contain the suffix.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public NavigablePath trimSuffix(DotIdentifierSequence suffix) {
|
||||||
|
if ( suffix == null ) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
if ( !getLocalName().equals( suffix.getLocalName() ) ) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if ( getParent() != null ) {
|
||||||
|
return getParent().trimSuffix( suffix.getParent() );
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine whether this path is part of the given path's parent
|
* Determine whether this path is part of the given path's parent
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue