String externalName = entity.externalName();
if (externalName != null) {
// If you have a parent entity and that parent entity shares your table name, then you're single table inheritance
boolean singleTableInheritance = (parentEntity != null && externalName.equals(parentEntity.externalName()));
if (singleTableInheritance) {
EOAttribute parentAttribute = parentEntity.attributeNamed(attribute.name());
if (parentAttribute == null) {
// If this attribute is new in the subclass, you have to allow nulls
shouldAllowNull = true;
}
}