Module is.codion.framework.domain
Interface ForeignKeyDefinition
- All Superinterfaces:
AttributeDefinition<Entity>
Represents a reference to another entity, typically but not necessarily based on a foreign key.
-
Nested Class Summary
Nested classes/interfaces inherited from interface is.codion.framework.domain.entity.attribute.AttributeDefinition
AttributeDefinition.ValueSupplier<T>
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final PropertyValue<Integer>
Specifies the default foreign key fetch depth Value type: Integer Default value: 1Fields inherited from interface is.codion.framework.domain.entity.attribute.AttributeDefinition
DATE_FORMAT, DATE_TIME_FORMAT, DECIMAL_ROUNDING_MODE, DECIMAL_SEPARATOR, DEFAULT_MAXIMUM_FRACTION_DIGITS, GROUPING_SEPARATOR, MAXIMUM_FRACTION_DIGITS, NUMBER_FORMAT_GROUPING, TIME_FORMAT, USE_LEXICAL_STRING_COMPARATOR
-
Method Summary
Methods inherited from interface is.codion.framework.domain.entity.attribute.AttributeDefinition
caption, comparator, dateTimeFormatter, dateTimePattern, decimalRoundingMode, defaultValue, derived, description, entityType, format, hasDefaultValue, hidden, items, maximumFractionDigits, maximumLength, maximumValue, minimumValue, mnemonic, nullable, string, validItem
-
Field Details
-
DEFAULT_FOREIGN_KEY_FETCH_DEPTH
static final int DEFAULT_FOREIGN_KEY_FETCH_DEPTH- See Also:
-
FOREIGN_KEY_FETCH_DEPTH
Specifies the default foreign key fetch depth- Value type: Integer
- Default value: 1
-
-
Method Details
-
attribute
ForeignKey attribute()Description copied from interface:AttributeDefinition
TheAttribute
this definition is based on, should be unique within an Entity. By default, theAttribute.name()
serves as column name for database columns.- Specified by:
attribute
in interfaceAttributeDefinition<Entity>
- Returns:
- the foreign key attribute this foreign key is based on.
-
fetchDepth
int fetchDepth()- Returns:
- the default query fetch depth for this foreign key
-
soft
boolean soft()- Returns:
- true if this foreign key is not based on a physical (table) foreign key and should not prevent deletion
-
readOnly
Returns true if the given foreign key reference column is read-only, as in, not updated when the foreign key value is set.- Parameters:
referenceColumn
- the reference column- Returns:
- true if the given foreign key reference column is read-only
-
references
List<ForeignKey.Reference<?>> references()- Returns:
- the
ForeignKey.Reference
s that comprise this foreign key
-
attributes
- Returns:
- the attributes to select when fetching entities referenced via this foreign key, an empty list in case of all attributes
-