HHH-17519 Initializing a lazy association with a non aggregate id causes a NPE
This commit is contained in:
parent
2969b112a5
commit
51d64b11a8
|
@ -947,6 +947,11 @@ public class ToOneAttributeMapping
|
||||||
final AssociationKey associationKey = foreignKeyDescriptor.getAssociationKey();
|
final AssociationKey associationKey = foreignKeyDescriptor.getAssociationKey();
|
||||||
final boolean associationKeyVisited = creationState.isAssociationKeyVisited( associationKey );
|
final boolean associationKeyVisited = creationState.isAssociationKeyVisited( associationKey );
|
||||||
if ( associationKeyVisited || bidirectionalAttributePath != null ) {
|
if ( associationKeyVisited || bidirectionalAttributePath != null ) {
|
||||||
|
if ( !associationKeyVisited && creationState.isRegisteringVisitedAssociationKeys() ) {
|
||||||
|
// If the current association key hasn't been visited yet and we are registering keys,
|
||||||
|
// then there can't be a circular fetch
|
||||||
|
return null;
|
||||||
|
}
|
||||||
NavigablePath parentNavigablePath = fetchablePath.getParent();
|
NavigablePath parentNavigablePath = fetchablePath.getParent();
|
||||||
assert parentNavigablePath.equals( fetchParent.getNavigablePath() );
|
assert parentNavigablePath.equals( fetchParent.getNavigablePath() );
|
||||||
// The parent navigable path is {fk} if we are creating the domain result for the foreign key for a circular fetch
|
// The parent navigable path is {fk} if we are creating the domain result for the foreign key for a circular fetch
|
||||||
|
@ -1005,12 +1010,6 @@ public class ToOneAttributeMapping
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !associationKeyVisited && creationState.isRegisteringVisitedAssociationKeys() ) {
|
|
||||||
// If the current association key hasn't been visited yet and we are registering keys,
|
|
||||||
// then there can't be a circular fetch
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
class Child {
|
class Child {
|
||||||
@OneToOne
|
@OneToOne
|
||||||
|
|
Loading…
Reference in New Issue