Class PrimaryKey

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

public class PrimaryKey extends Key
Representation of the primary key of a table. TODO MariaDB apparently allows "ALTER TABLE ADD CONSTRAINT PRIMARY KEY (col1 ASC, col2 DESC)" not that many others do but we don't allow that here, would need to extend ColumnOrderedKey for that, plus update to MySQL Adapter
  • Constructor Details

    • PrimaryKey

      public PrimaryKey(Table table)
      Creates a primary key. A default name of the primary key is created by the constructor. This name can be overwritten.
      Parameters:
      table - Table that this is the PK for
  • Method Details

    • 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.
    • hashCode

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

      public String toString()
      Stringifier method. Generates a form of the PK ready to be used in a DDL statement. e.g
      PRIMARY KEY (col1,col2)
      Overrides:
      toString in class Object
      Returns:
      The string form of this object. Ready to be used in a DDL statement.