Package org.datanucleus.store.rdbms.key
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 Summary
Constructors Constructor Description PrimaryKey(Table table)
Creates a primary key.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
Equality operator.int
hashCode()
Hashcode operator.java.lang.String
toString()
Stringifier method.-
Methods inherited from class org.datanucleus.store.rdbms.key.Key
addColumn, assertSameDatastoreObject, getColumnList, getColumnList, getColumns, getName, getNumberOfColumns, getTable, setColumn, setListMinimumSize, setName
-
-
-
-
Constructor Detail
-
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 Detail
-
equals
public boolean equals(java.lang.Object obj)
Description copied from class:Key
Equality operator.
-
hashCode
public int hashCode()
Description copied from class:Key
Hashcode operator.
-
toString
public java.lang.String toString()
Stringifier method. Generates a form of the PK ready to be used in a DDL statement. e.gPRIMARY KEY (col1,col2)
- Overrides:
toString
in classjava.lang.Object
- Returns:
- The string form of this object. Ready to be used in a DDL statement.
-
-