Interface ForeignKeyDefinition

All Superinterfaces:

public interface ForeignKeyDefinition extends AttributeDefinition<Entity>
Represents a reference to another entity, typically but not necessarily based on a foreign key.
  • Field Details


      static final int DEFAULT_FOREIGN_KEY_FETCH_DEPTH
      See Also:

      static final PropertyValue<Integer> 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
      The Attribute this definition is based on, should be unique within an Entity. By default, the serves as column name for database columns.
      Specified by:
      attribute in interface AttributeDefinition<Entity>
      the foreign key attribute this foreign key is based on.
    • fetchDepth

      int fetchDepth()
      the default query fetch depth for this foreign key
    • soft

      boolean soft()
      true if this foreign key is not based on a physical (table) foreign key and should not prevent deletion
    • readOnly

      boolean readOnly(Column<?> referenceColumn)
      Returns true if the given foreign key reference column is read-only, as in, not updated when the foreign key value is set.
      referenceColumn - the reference column
      true if the given foreign key reference column is read-only
    • references

      List<ForeignKey.Reference<?>> references()
      the ForeignKey.References that comprise this foreign key
    • attributes

      List<Attribute<?>> attributes()
      the attributes to select when fetching entities referenced via this foreign key, an empty list in case of all attributes