HHH-6547 : Basic properties cannot be made nullable in HBM XML
This commit is contained in:
parent
cb5a74fd51
commit
6065d57e39
|
@ -987,12 +987,16 @@ public class Binder {
|
|||
.getNamingStrategy()
|
||||
.propertyToColumnName( attributeBinding.getAttribute().getName() );
|
||||
name = quoteIdentifier( name );
|
||||
valueBindings.add(
|
||||
new SimpleValueBinding(
|
||||
attributeBinding.getContainer()
|
||||
Column column = attributeBinding.getContainer()
|
||||
.seekEntityBinding()
|
||||
.getPrimaryTable()
|
||||
.locateOrCreateColumn( name )
|
||||
.locateOrCreateColumn( name );
|
||||
column.setNullable( relationalValueSourceContainer.areValuesNullableByDefault() );
|
||||
valueBindings.add(
|
||||
new SimpleValueBinding(
|
||||
column,
|
||||
relationalValueSourceContainer.areValuesIncludedInInsertByDefault(),
|
||||
relationalValueSourceContainer.areValuesIncludedInUpdateByDefault()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -166,6 +166,7 @@ public abstract class AbstractBasicBindingTests extends BaseUnitTestCase {
|
|||
assertTrue( idAttributeBinding.getAttribute().isSingular() );
|
||||
assertNotNull( idAttributeBinding.getAttribute() );
|
||||
SingularAttributeBinding singularIdAttributeBinding = (SingularAttributeBinding) idAttributeBinding;
|
||||
assertFalse( singularIdAttributeBinding.isNullable() );
|
||||
SingularAttribute singularIdAttribute = ( SingularAttribute ) idAttributeBinding.getAttribute();
|
||||
BasicType basicIdAttributeType = ( BasicType ) singularIdAttribute.getSingularAttributeType();
|
||||
assertSame( Long.class, basicIdAttributeType.getClassReference() );
|
||||
|
@ -182,6 +183,7 @@ public abstract class AbstractBasicBindingTests extends BaseUnitTestCase {
|
|||
assertTrue( entityBinding.locateAttributeBinding( "name" ).getAttribute().isSingular() );
|
||||
|
||||
SingularAttributeBinding nameBinding = (SingularAttributeBinding) entityBinding.locateAttributeBinding( "name" );
|
||||
assertTrue( nameBinding.isNullable() );
|
||||
assertSame( StringType.INSTANCE, nameBinding.getHibernateTypeDescriptor().getResolvedTypeMapping() );
|
||||
assertNotNull( nameBinding.getAttribute() );
|
||||
assertNotNull( nameBinding.getValue() );
|
||||
|
|
Loading…
Reference in New Issue