#1743 - Add hasForeignKeyConstraint()

Separate hasForeignKeyConstraint() for DDL use from hasForeignKey() used in query
This commit is contained in:
rob bygrave
2019-07-01 21:04:40 +12:00
parent 9f19ed5376
commit 7f2e4f54ff
4 changed files with 18 additions and 10 deletions
@@ -155,6 +155,20 @@ public abstract class BeanPropertyAssoc<T> extends BeanProperty implements STree
return foreignKey;
}
/**
* Return true if foreign key constraint is enabled on this relationship (not disabled).
*/
public boolean hasForeignKeyConstraint() {
return foreignKey == null || !foreignKey.isNoConstraint();
}
/**
* Return true if foreign key index is enabled on this relationship (not disabled).
*/
public boolean hasForeignKeyIndex() {
return foreignKey == null || !foreignKey.isNoIndex();
}
/**
* Create a ElPropertyValue for a *ToOne or *ToMany.
*/
@@ -228,7 +242,7 @@ public abstract class BeanPropertyAssoc<T> extends BeanProperty implements STree
/**
* Create a new query for the target type.
*
* <p>
* We use target descriptor rather than target property type to support ElementCollection.
*/
public SpiQuery<T> newQuery(SpiEbeanServer server) {
@@ -363,10 +363,6 @@ public class BeanPropertyAssocOne<T> extends BeanPropertyAssoc<T> implements STr
return foreignKey == null || primaryKeyJoin || !foreignKey.isNoConstraint();
}
public boolean hasForeignKeyIndex() {
return foreignKey == null || !foreignKey.isNoIndex();
}
/**
* Return true if this a OneToOne property. Otherwise assumed ManyToOne.
*/