Class ForeignKeyMetaData

All Implemented Interfaces:
Serializable

public class ForeignKeyMetaData extends ConstraintMetaData
Foreign keys in metadata serve two quite different purposes. First, when generating schema, the foreign key element identifies foreign keys to be generated. Second, when using the database, foreign key elements identify foreign keys that are assumed to exist in the database. This is important for the runtime to properly order insert, update, and delete statements to avoid constraint violations. A foreign-key element can be contained by a field, element, key, value, or join element, if all of the columns mapped are to be part of the same foreign key. A foreign-key element can be contained within a class element. In this case, the column elements are mapped elsewhere, and the column elements contained in the foreign-key element have only the column name.
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • columns

      protected List<ColumnMetaData> columns
      The columns for this foreign key. Note that we don't use the "columnNames" in the superclass since the user can define the column target name also for a foreign-key.
    • unique

      protected boolean unique
      The unique attribute specifies whether the foreign key constraint is defined to be a unique constraint as well. This is most often used with one-to-one mappings.
    • deferred

      protected boolean deferred
      The deferred attribute specifies whether the foreign key constraint is defined to be checked only at commit time.
    • deleteAction

      protected ForeignKeyAction deleteAction
      Foreign keys represent a consistency constraint in the database that must be maintained. The user can specify by the value of the delete-action attribute what happens if the target row of a foreign key is deleted.
    • updateAction

      protected ForeignKeyAction updateAction
      Foreign keys represent a consistency constraint in the database that must be maintained. The user can specify by the update-action attribute what happens if the target row of a foreign key is updated.
    • fkDefinition

      protected String fkDefinition
      Alternative method of specifying FK where we just supply the string defining it (JPA crap).
    • fkDefinitionApplies

      protected boolean fkDefinitionApplies
  • Constructor Details

    • ForeignKeyMetaData

      public ForeignKeyMetaData()
    • ForeignKeyMetaData

      public ForeignKeyMetaData(ForeignKeyMetaData fkmd)
      Copy constructor.
      Parameters:
      fkmd - The metadata to copy
  • Method Details

    • addColumn

      public void addColumn(ColumnMetaData colmd)
    • newColumnMetaData

      public ColumnMetaData newColumnMetaData()
      Method to create a new column, add it, and return it.
      Returns:
      The column metadata
    • getColumnMetaData

      public final ColumnMetaData[] getColumnMetaData()
    • isDeferred

      public final boolean isDeferred()
    • setDeferred

      public ForeignKeyMetaData setDeferred(boolean deferred)
    • setDeferred

      public ForeignKeyMetaData setDeferred(String deferred)
    • getDeleteAction

      public final ForeignKeyAction getDeleteAction()
    • setDeleteAction

      public void setDeleteAction(ForeignKeyAction deleteAction)
    • isUnique

      public final boolean isUnique()
    • setUnique

      public ForeignKeyMetaData setUnique(boolean unique)
    • setUnique

      public ForeignKeyMetaData setUnique(String unique)
    • getUpdateAction

      public final ForeignKeyAction getUpdateAction()
    • setUpdateAction

      public ForeignKeyMetaData setUpdateAction(ForeignKeyAction updateAction)
    • setFkDefinition

      public void setFkDefinition(String def)
    • getFkDefinition

      public String getFkDefinition()
    • setFkDefinitionApplies

      public void setFkDefinitionApplies(boolean flag)
    • getFkDefinitionApplies

      public boolean getFkDefinitionApplies()