public class FKConstraint extends ColumnConstraint
FKConstraint
represents a Foreign Key Constraint.
A foreign key constraint requires values in the constrained table to match
values in another table.
An FKConstraint contains a reference to a UniqueConstraint. This referenced constraint determines the valid values for the columns constrained.
Modifier and Type | Class and Description |
---|---|
static class |
FKConstraint.ReferentialAction
The action to take "ON DELETE" or "ON UPDATE" for a FK (where supported
by the underlying Database).
|
Constraint.DeferrableState
AbstractDBObject.ChildSupport, AbstractDBObject.ListenerSupport
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CONSTRAINT_TYPE |
static int |
ON_DELETE_CASCADE
Deprecated.
use ReferentialAction.CASCADE instead
|
static int |
ON_DELETE_RESTRICT
Deprecated.
use ReferentialAction.RESTRICT instead
|
static int |
ON_DELETE_SET_NULL
Deprecated.
use ReferentialAction.SET_NULL instead
|
TYPE
Constructor and Description |
---|
FKConstraint()
Constructs a new FKConstraint.
|
FKConstraint(java.lang.String name,
Relation relation)
Constructs a new FKConstraint with 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.
|
int |
getDeleteMode()
Deprecated.
replaced by
getOnDeleteAction() |
FKConstraint.ReferentialAction |
getOnDeleteAction()
Gets the "referential action" that the database will take on delete of
a row contained in the referenced table.
|
DBObjectID |
getReferenceID()
Retrieves the Object ID of the referenced unique constraint.
|
void |
setDeleteMode(int onDelete)
Deprecated.
|
void |
setOnDeleteAction(FKConstraint.ReferentialAction action)
Sets the "referential action" that the database will take on delete of
a row contained in the referenced table.
|
void |
setReferenceID(DBObjectID id)
Sets the Object ID of the referenced unique constraint.
|
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
@Deprecated public static final int ON_DELETE_RESTRICT
@Deprecated public static final int ON_DELETE_CASCADE
@Deprecated public static final int ON_DELETE_SET_NULL
public FKConstraint()
public FKConstraint(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 constrained.public void setReferenceID(DBObjectID id)
id
- The DBObjectID of the referenced constraintpublic DBObjectID getReferenceID()
public java.lang.String getConstraintType()
Constraint
getConstraintType
in class Constraint
public FKConstraint.ReferentialAction getOnDeleteAction()
public void setOnDeleteAction(FKConstraint.ReferentialAction action)
@Deprecated public int getDeleteMode()
getOnDeleteAction()
@Deprecated public void setDeleteMode(int onDelete)
setOnDeleteAction(oracle.javatools.db.FKConstraint.ReferentialAction)