HHH-13241 : Fix regression with an uninitialized null many-to-one association

This commit is contained in:
Gail Badner 2019-03-20 17:27:32 -07:00 committed by gbadner
parent 65eebbb96b
commit b28dc488a1
1 changed files with 11 additions and 5 deletions

View File

@ -100,11 +100,17 @@ public final class ForeignKeys {
// If value is lazy, it may need to be initialized to // If value is lazy, it may need to be initialized to
// determine if the value is nullifiable. // determine if the value is nullifiable.
final Object possiblyInitializedValue = initializeIfNecessary( value, propertyName, entityType ); final Object possiblyInitializedValue = initializeIfNecessary( value, propertyName, entityType );
// If the value is not nullifiable, make sure that the if ( possiblyInitializedValue == null ) {
// possibly initialized value is returned. // The uninitialized value was initialized to null
returnedValue = isNullifiable( entityType.getAssociatedEntityName(), possiblyInitializedValue ) returnedValue = null;
? null }
: possiblyInitializedValue; else {
// If the value is not nullifiable, make sure that the
// possibly initialized value is returned.
returnedValue = isNullifiable( entityType.getAssociatedEntityName(), possiblyInitializedValue )
? null
: possiblyInitializedValue;
}
} }
} }
else if ( type.isAnyType() ) { else if ( type.isAnyType() ) {