Interface ForeignKeyDefinition

All Superinterfaces:
AttributeDefinition<Entity>

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

    • DEFAULT_FOREIGN_KEY_FETCH_DEPTH

      static final int DEFAULT_FOREIGN_KEY_FETCH_DEPTH
      The default number of levels of foreign keys to fetch
      See Also:
    • FOREIGN_KEY_FETCH_DEPTH

      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 Attribute.name() serves as column name for database columns.
      Specified by:
      attribute in interface AttributeDefinition<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

      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.
      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.References that comprise this foreign key
    • attributes

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