public class UniqueConstraint extends ColumnConstraint
UniqueConstraint
prohibits multiple rows from having the
same value in the same column or combination of columns but allows some
values to be null.
The list of columns constrained by the UniqueConstraint is stored by column name.
Constraint.DeferrableState
AbstractDBObject.ChildSupport, AbstractDBObject.ListenerSupport
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CONSTRAINT_TYPE |
TYPE
Constructor and Description |
---|
UniqueConstraint()
Creates a new Constraint.
|
UniqueConstraint(java.lang.String name,
Relation relation)
Creates a new Constraint of the specified name for the specified
relation.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getConstraintType()
Retrieves the type of constraint represented by this instance.
|
DBObjectID |
getIndexID()
Get the Index that implements this UniqueConstraint
|
static boolean |
isUnique(Column col)
Returns true if the given table is constrained by a UniqueConstraint
(including PKConstraint) in its parent table.
|
void |
setIndexID(DBObjectID id)
Set the Index that implements this UniqueConstraint
|
addColumn, addColumnImpl, 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 UniqueConstraint()
public UniqueConstraint(java.lang.String name, Relation relation)
Relation.addConstraint(Constraint)
when
the constraint definition is complete.name
- a string containing the name of the constraintrelation
- the Relation being constrainedpublic java.lang.String getConstraintType()
Constraint
getConstraintType
in class Constraint
public DBObjectID getIndexID()
public void setIndexID(DBObjectID id)
id
- the ID of the Indexpublic static boolean isUnique(Column col)
ColumnConstraint.isConstrained(oracle.javatools.db.Column, java.lang.String...)
.col
- the column to test