Class ForeignKey

java.lang.Object
org.datanucleus.store.rdbms.key.Key
org.datanucleus.store.rdbms.key.ForeignKey

public class ForeignKey extends Key
Representation of a foreign key to another table.
  • Field Details

  • Constructor Details

    • ForeignKey

      public ForeignKey(DatastoreAdapter dba, boolean initiallyDeferred)
      Constructor.
      Parameters:
      dba - Datastore adapter
      initiallyDeferred - Whether the constraints are deferred
    • ForeignKey

      public ForeignKey(JavaTypeMapping mapping, DatastoreAdapter dba, DatastoreClass refTable, boolean initiallyDeferred)
      Constructor.
      Parameters:
      mapping - The type mapping for this Foreign-key field
      dba - Datastore adapter
      refTable - Referred to table
      initiallyDeferred - Whether they are deferred
  • Method Details

    • setForMetaData

      public void setForMetaData(org.datanucleus.metadata.ForeignKeyMetaData fkmd)
      Convenience mutator for setting the specification based on MetaData
      Parameters:
      fkmd - ForeignKey MetaData definition
    • setDeleteAction

      public void setDeleteAction(ForeignKey.FKAction deleteAction)
      Mutator for deleteAction.
      Parameters:
      deleteAction - The deleteAction to set.
    • setUpdateAction

      public void setUpdateAction(ForeignKey.FKAction updateAction)
      Mutator for updateAction.
      Parameters:
      updateAction - The updateAction to set.
    • addColumn

      public void addColumn(Column col, Column refCol)
      Method to add a Column.
      Parameters:
      col - The column to add
      refCol - The column to reference
    • getRefTable

      public DatastoreClass getRefTable()
    • getRefColumnList

      public String getRefColumnList()
    • setColumn

      public void setColumn(int seq, Column col, Column refCol)
      Set the column for the specified position seq
      Parameters:
      seq - the specified position
      col - the column
      refCol - the foreign (refered) column
    • hashCode

      public int hashCode()
      Description copied from class: Key
      Hashcode operator.
      Overrides:
      hashCode in class Key
      Returns:
      The hashcode
    • equals

      public boolean equals(Object obj)
      Description copied from class: Key
      Equality operator.
      Overrides:
      equals in class Key
      Parameters:
      obj - Object to compare against
      Returns:
      Whether they are equal.
    • isEqual

      public boolean isEqual(ForeignKey fk)
    • toString

      public String toString()
      Stringify method. Generates the foreign key statement ready for use in an SQL call.
      Overrides:
      toString in class Object
      Returns:
      String version of this object.