Class ForeignKeyConstraint

java.lang.Object
org.eclipse.persistence.tools.schemaframework.ForeignKeyConstraint
All Implemented Interfaces:
Serializable

public class ForeignKeyConstraint extends Object implements Serializable

Purpose: Define a foreign key from one table to another. This support composite foreign keys can constraint options.

See Also:
  • Field Details

    • name

      protected String name
    • sourceFields

      protected List<String> sourceFields
    • targetFields

      protected List<String> targetFields
    • targetTable

      protected String targetTable
    • shouldCascadeOnDelete

      protected boolean shouldCascadeOnDelete
    • foreignKeyDefinition

      protected String foreignKeyDefinition
    • disableForeignKey

      protected boolean disableForeignKey
  • Constructor Details

    • ForeignKeyConstraint

      public ForeignKeyConstraint()
    • ForeignKeyConstraint

      public ForeignKeyConstraint(String name, String sourceField, String targetField, String targetTable)
  • Method Details

    • addSourceField

      public void addSourceField(String sourceField)
    • addTargetField

      public void addTargetField(String targetField)
    • appendDBString

      public void appendDBString(Writer writer, org.eclipse.persistence.internal.sessions.AbstractSession session)
      INTERNAL: Append the database field definition string to the table creation statement.
    • cascadeOnDelete

      public void cascadeOnDelete()
      PUBLIC: Enables delete cascading on the database. This must be used carefully, i.e. only private relationships.
    • disableForeignKey

      public boolean disableForeignKey()
    • dontCascadeOnDelete

      public void dontCascadeOnDelete()
      PUBLIC: Disables delete cascading on the database, this is the default.
    • getForeignKeyDefinition

      public String getForeignKeyDefinition()
    • getName

      public String getName()
    • getSourceFields

      public List<String> getSourceFields()
    • getTargetFields

      public List<String> getTargetFields()
    • getTargetTable

      public String getTargetTable()
    • hasForeignKeyDefinition

      public boolean hasForeignKeyDefinition()
    • isDisableForeignKey

      public boolean isDisableForeignKey()
    • setDisableForeignKey

      public void setDisableForeignKey(boolean disableForeignKey)
    • setForeignKeyDefinition

      public void setForeignKeyDefinition(String foreignKeyDefinition)
    • setName

      public void setName(String name)
    • setShouldCascadeOnDelete

      public void setShouldCascadeOnDelete(boolean shouldCascadeOnDelete)
      PUBLIC: Enables delete cascading on the database. This must be used carefully, i.e. only private relationships.
    • setSourceFields

      public void setSourceFields(List<String> sourceFields)
    • setTargetFields

      public void setTargetFields(List<String> targetFields)
    • setTargetTable

      public void setTargetTable(String targetTable)
    • shouldCascadeOnDelete

      public boolean shouldCascadeOnDelete()