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.DeferrableStateAbstractDBObject.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, setColumnsgetConstraints, getConstraintTypes, getDeferrableState, getRelation, getType, isEnabled, setDeferrableState, setEnabled, setRelationsetParentcheckInit, checkInit, copyToImpl, getOwnedObjectsImpl, getProperties, getReferenceIDsImpl, needsInitializationaddObjectListener, 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, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetParentaddObjectListener, copyTo, copyTo, copyTo, equals, findOwnedObject, findOwnedObject, findOwnedObject, getID, getName, getOwnedObjects, getOwnedObjects, getProperties, getReferenceIDs, hashCode, removeObjectListener, removeOwnedObject, replaceReferenceIDs, setID, setNamegetProperty, getProperty, setProperties, setPropertypublic 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()
ConstraintgetConstraintType in class Constraintpublic 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)