Module is.codion.framework.domain
Interface ForeignKeyDefinition.Builder
- All Superinterfaces:
AttributeDefinition.Builder<Entity,
ForeignKeyDefinition.Builder>
- Enclosing interface:
ForeignKeyDefinition
public static interface ForeignKeyDefinition.Builder
extends AttributeDefinition.Builder<Entity,ForeignKeyDefinition.Builder>
Builds a
ForeignKeyDefinition
.-
Method Summary
Modifier and TypeMethodDescriptionattributes
(Attribute<?>... attributes) Specifies the attributes from the referenced entity to select.Marks the given foreign key reference column as read-only, which causes an exception being thrown when the given column value is modified via this foreign key.referenceDepth
(int referenceDepth) Specifies the default query reference depth for this foreign key.soft
(boolean soft) Marks this foreign key as being soft, that is, not based on a physical (table) foreign key and should not prevent deletionMethods inherited from interface is.codion.framework.domain.entity.attribute.AttributeDefinition.Builder
attribute, build, caption, captionResourceKey, comparator, dateTimePattern, decimalRoundingMode, defaultValue, defaultValue, description, format, hidden, items, localeDateTimePattern, maximumFractionDigits, maximumLength, maximumValue, minimumValue, mnemonic, mnemonicResourceKey, nullable, numberFormatGrouping, trim, valueRange
-
Method Details
-
soft
Marks this foreign key as being soft, that is, not based on a physical (table) foreign key and should not prevent deletion- Parameters:
soft
- if true then this foreign key is marked as a non-physical soft key- Returns:
- this instance
-
readOnly
Marks the given foreign key reference column as read-only, which causes an exception being thrown when the given column value is modified via this foreign key.- Parameters:
column
- the reference column- Returns:
- this instance
-
attributes
Specifies the attributes from the referenced entity to select. Note that the primary key attributes are always selected and do not have to be added via this method.- Parameters:
attributes
- the attributes to select- Returns:
- this instance
-
referenceDepth
Specifies the default query reference depth for this foreign key.Reference depth: -1: the full foreign key graph of the referenced entity is fetched. 0: the referenced entity not fetched. 1: the referenced entity is fetched, without any foreign key references. 2: the referenced entity is fetched, with a single level of foreign key references. 3: the referenced entity is fetched, with two levels of foreign key references. etc...
- Parameters:
referenceDepth
- the number of levels of foreign key references to fetch for this foreign key- Returns:
- this instance
- Throws:
IllegalArgumentException
- in case reference depth is less than -1
-