Rename ToOneAttributeMapping isInternalLoadNullable to isOptional

This commit is contained in:
Andrea Boriero 2021-10-18 14:05:37 +02:00
parent f02ffde061
commit 1ffa1347a3
2 changed files with 9 additions and 8 deletions

View File

@ -98,6 +98,7 @@ public class ToOneAttributeMapping
private final boolean isConstrained; private final boolean isConstrained;
private final boolean isIgnoreNotFound; private final boolean isIgnoreNotFound;
private final boolean unwrapProxy; private final boolean unwrapProxy;
private final boolean isOptional;
private final EntityMappingType entityMappingType; private final EntityMappingType entityMappingType;
private final String referencedPropertyName; private final String referencedPropertyName;
@ -113,11 +114,6 @@ public class ToOneAttributeMapping
private String identifyingColumnsTableExpression; private String identifyingColumnsTableExpression;
private boolean canUseParentTableGroup; private boolean canUseParentTableGroup;
private boolean isInternalLoadNullable;
public boolean isInternalLoadNullable(){
return isInternalLoadNullable;
}
public ToOneAttributeMapping( public ToOneAttributeMapping(
String name, String name,
@ -199,7 +195,7 @@ public class ToOneAttributeMapping
else { else {
this.bidirectionalAttributeName = referencedPropertyName; this.bidirectionalAttributeName = referencedPropertyName;
} }
isInternalLoadNullable = ( (ManyToOne) bootValue ).isIgnoreNotFound(); isOptional = ( (ManyToOne) bootValue ).isIgnoreNotFound();
} }
else { else {
assert bootValue instanceof OneToOne; assert bootValue instanceof OneToOne;
@ -265,7 +261,7 @@ public class ToOneAttributeMapping
this.bidirectionalAttributeName = bidirectionalAttributeName; this.bidirectionalAttributeName = bidirectionalAttributeName;
} }
isIgnoreNotFound = isNullable(); isIgnoreNotFound = isNullable();
isInternalLoadNullable = ! bootValue.isConstrained(); isOptional = ! bootValue.isConstrained();
} }
isConstrained = bootValue.isConstrained(); isConstrained = bootValue.isConstrained();
@ -344,6 +340,7 @@ public class ToOneAttributeMapping
this.navigableRole = original.navigableRole; this.navigableRole = original.navigableRole;
this.sqlAliasStem = original.sqlAliasStem; this.sqlAliasStem = original.sqlAliasStem;
this.isNullable = original.isNullable; this.isNullable = original.isNullable;
this.isOptional = original.isOptional;
this.isIgnoreNotFound = original.isIgnoreNotFound; this.isIgnoreNotFound = original.isIgnoreNotFound;
this.unwrapProxy = original.unwrapProxy; this.unwrapProxy = original.unwrapProxy;
this.entityMappingType = original.entityMappingType; this.entityMappingType = original.entityMappingType;
@ -1053,6 +1050,10 @@ public class ToOneAttributeMapping
return isNullable; return isNullable;
} }
public boolean isOptional(){
return isOptional;
}
public boolean isConstrained(){ public boolean isConstrained(){
return isConstrained; return isConstrained;
} }

View File

@ -83,7 +83,7 @@ public class EntityDelayedFetchInitializer extends AbstractFetchParentAccess imp
entityInstance = loadingEntityLocally.getEntityInstance(); entityInstance = loadingEntityLocally.getEntityInstance();
} }
else { else {
if ( referencedModelPart.isInternalLoadNullable() ) { if ( referencedModelPart.isOptional() ) {
entityInstance = LazyPropertyInitializer.UNFETCHED_PROPERTY; entityInstance = LazyPropertyInitializer.UNFETCHED_PROPERTY;
} }
else { else {