HHH-12166 : AbstractCompositionAttribute#getAttributes throws NPE for nested CompositeCustomType

This commit is contained in:
Gail Badner 2018-03-29 17:29:53 -07:00
parent 05404eff0f
commit 216ad13e6c
1 changed files with 6 additions and 9 deletions

View File

@ -83,6 +83,11 @@ public abstract class AbstractCompositionAttribute
int columnPosition = currentColumnPosition;
currentColumnPosition += type.getColumnSpan( sessionFactory() );
final CompositeType cType = getType();
final boolean nullable =
cType.getPropertyNullability() == null ||
cType.getPropertyNullability()[subAttributeNumber];
if ( type.isAssociationType() ) {
// we build the association-key here because of the "goofiness" with 'currentColumnPosition'
final AssociationKey associationKey;
@ -134,11 +139,6 @@ public abstract class AbstractCompositionAttribute
);
}
final CompositeType cType = getType();
final boolean nullable =
cType.getPropertyNullability() == null ||
cType.getPropertyNullability()[subAttributeNumber];
return new CompositeBasedAssociationAttribute(
AbstractCompositionAttribute.this,
sessionFactory(),
@ -173,7 +173,7 @@ public abstract class AbstractCompositionAttribute
.setUpdateable( AbstractCompositionAttribute.this.isUpdateable() )
// todo : handle nested ValueGeneration strategies...
// disallow if our strategy != NEVER
.setNullable( getType().getPropertyNullability()[subAttributeNumber] )
.setNullable( nullable )
.setDirtyCheckable( true )
.setVersionable( AbstractCompositionAttribute.this.isVersionable() )
.setCascadeStyle( getType().getCascadeStyle( subAttributeNumber ) )
@ -182,9 +182,6 @@ public abstract class AbstractCompositionAttribute
);
}
else {
final CompositeType cType = getType();
final boolean nullable = cType.getPropertyNullability() == null || cType.getPropertyNullability()[subAttributeNumber];
return new CompositeBasedBasicAttribute(
AbstractCompositionAttribute.this,
sessionFactory(),