HHH-7503 Adding check for single table inheritance in which case the @NotNull constraint is not applied
This commit is contained in:
parent
88d75b541d
commit
d541b9abff
|
@ -33,6 +33,8 @@ import org.hibernate.mapping.Column;
|
|||
import org.hibernate.mapping.Property;
|
||||
import org.hibernate.mapping.SingleTableSubclass;
|
||||
import org.hibernate.metamodel.spi.binding.AttributeBinding;
|
||||
import org.hibernate.metamodel.spi.binding.EntityBinding;
|
||||
import org.hibernate.metamodel.spi.binding.InheritanceType;
|
||||
|
||||
/**
|
||||
* @author Hardy Ferentschik
|
||||
|
@ -65,6 +67,14 @@ public class NotNullSchemaConstraint implements SchemaConstraint {
|
|||
return false;
|
||||
}
|
||||
|
||||
EntityBinding entityBinding = (EntityBinding) attributeBinding.getContainer();
|
||||
InheritanceType inheritanceType = entityBinding.getHierarchyDetails().getInheritanceType();
|
||||
|
||||
// properties of a single table inheritance configuration should not be forced to null
|
||||
if(InheritanceType.SINGLE_TABLE.equals( inheritanceType )) {
|
||||
return false;
|
||||
}
|
||||
|
||||
org.hibernate.metamodel.spi.relational.Column column = SchemaModificationHelper.getSingleColumn( attributeBinding );
|
||||
if ( column == null ) {
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue