public class PKConstraint extends UniqueConstraint
PKConstraint
represents a Primary Key constraint. A Primary Key
combines a NOT NULL constraint and a unique constraint in a single declaration.
That is, it prohibits multiple rows from having the same value in the
same column or combination of columns and prohibits values from being null.
Constraint.DeferrableState
AbstractDBObject.ChildSupport, AbstractDBObject.ListenerSupport
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CONSTRAINT_TYPE |
TYPE
Constructor and Description |
---|
PKConstraint()
Constructs a new PKConstraint.
|
PKConstraint(java.lang.String name,
Relation relation)
Constructs a new PKConstraint for the specified Relation with the
specified name.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addColumnImpl(Column col,
Relation relForColumn) |
java.lang.String |
getConstraintType()
Retrieves the type of constraint represented by this instance.
|
static PKConstraint |
getPrimaryKey(Relation table)
Returns a primary key for the given table, if it owns one.
|
getIndexID, isUnique, setIndexID
addColumn, getColumnIDs, getColumns, isConstrained, removeColumn, setColumnIDs, setColumns
getConstraints, getConstraintTypes, getDeferrableState, getRelation, getType, isEnabled, setDeferrableState, setEnabled, setRelation
setParent
checkInit, checkInit, copyToImpl, getOwnedObjectsImpl, getProperties, getReferenceIDsImpl, needsInitialization
addObjectListener, addObjectListener, addObjectListener, changeParent, compareToImpl, copyObject, copyTo, copyTo, copyTo, copyTo, equals, equalsImpl, findOwnedObject, findOwnedObject, findOwnedObject, findOwnedObject, findParent, fireObjectUpdated, firePropertyChanged, getChildSupport, getID, getName, getOwnedObjects, getOwnedObjects, getParent, getProperty, getProperty, getReferenceIDs, hashCode, includeOwnedObject, includesType, includesType, removeObjectListener, removeObjectListener, removeObjectListener, removeOwnedObject, removeThisAsParent, replaceReferenceIDs, setID, setName, setProperties, setProperty, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getParent
addObjectListener, copyTo, copyTo, copyTo, equals, findOwnedObject, findOwnedObject, findOwnedObject, getID, getName, getOwnedObjects, getOwnedObjects, getProperties, getReferenceIDs, hashCode, removeObjectListener, removeOwnedObject, replaceReferenceIDs, setID, setName
getProperty, getProperty, setProperties, setProperty
public static final java.lang.String CONSTRAINT_TYPE
public PKConstraint()
public PKConstraint(java.lang.String name, Relation relation)
Relation.addConstraint(Constraint)
when
the constraint definition is complete.a
- string containing the name of the constraintrelation
- the relation on which this constraint actspublic java.lang.String getConstraintType()
Constraint
getConstraintType
in class UniqueConstraint
public static final PKConstraint getPrimaryKey(Relation table)
protected void addColumnImpl(Column col, Relation relForColumn)
addColumnImpl
in class ColumnConstraint