public class ForeignKeyConstraint
extends java.lang.Object
implements java.io.Serializable
Purpose: Define a foreign key from one table to another. This support composite foreign keys can constraint options.
Modifier and Type | Field and Description |
---|---|
protected boolean |
disableForeignKey |
protected java.lang.String |
foreignKeyDefinition |
protected java.lang.String |
name |
protected boolean |
shouldCascadeOnDelete |
protected java.util.List<java.lang.String> |
sourceFields |
protected java.util.List<java.lang.String> |
targetFields |
protected java.lang.String |
targetTable |
Constructor and Description |
---|
ForeignKeyConstraint() |
ForeignKeyConstraint(java.lang.String name,
java.lang.String sourceField,
java.lang.String targetField,
java.lang.String targetTable) |
Modifier and Type | Method and Description |
---|---|
void |
addSourceField(java.lang.String sourceField) |
void |
addTargetField(java.lang.String targetField) |
void |
appendDBString(java.io.Writer writer,
org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL:
Append the database field definition string to the table creation statement.
|
void |
cascadeOnDelete()
PUBLIC:
Enables delete cascading on the database.
|
boolean |
disableForeignKey() |
void |
dontCascadeOnDelete()
PUBLIC:
Disables delete cascading on the database, this is the default.
|
java.lang.String |
getForeignKeyDefinition() |
java.lang.String |
getName() |
java.util.List<java.lang.String> |
getSourceFields() |
java.util.List<java.lang.String> |
getTargetFields() |
java.lang.String |
getTargetTable() |
boolean |
hasForeignKeyDefinition() |
boolean |
isDisableForeignKey() |
void |
setDisableForeignKey(boolean disableForeignKey) |
void |
setForeignKeyDefinition(java.lang.String foreignKeyDefinition) |
void |
setName(java.lang.String name) |
void |
setShouldCascadeOnDelete(boolean shouldCascadeOnDelete)
PUBLIC:
Enables delete cascading on the database.
|
void |
setSourceFields(java.util.List<java.lang.String> sourceFields) |
void |
setTargetFields(java.util.List<java.lang.String> targetFields) |
void |
setTargetTable(java.lang.String targetTable) |
boolean |
shouldCascadeOnDelete() |
protected java.lang.String name
protected java.util.List<java.lang.String> sourceFields
protected java.util.List<java.lang.String> targetFields
protected java.lang.String targetTable
protected boolean shouldCascadeOnDelete
protected java.lang.String foreignKeyDefinition
protected boolean disableForeignKey
public ForeignKeyConstraint()
public ForeignKeyConstraint(java.lang.String name, java.lang.String sourceField, java.lang.String targetField, java.lang.String targetTable)
public void addSourceField(java.lang.String sourceField)
public void addTargetField(java.lang.String targetField)
public void appendDBString(java.io.Writer writer, org.eclipse.persistence.internal.sessions.AbstractSession session)
public void cascadeOnDelete()
public boolean disableForeignKey()
public void dontCascadeOnDelete()
public java.lang.String getForeignKeyDefinition()
public java.lang.String getName()
public java.util.List<java.lang.String> getSourceFields()
public java.util.List<java.lang.String> getTargetFields()
public java.lang.String getTargetTable()
public boolean hasForeignKeyDefinition()
public boolean isDisableForeignKey()
public void setDisableForeignKey(boolean disableForeignKey)
public void setForeignKeyDefinition(java.lang.String foreignKeyDefinition)
public void setName(java.lang.String name)
public void setShouldCascadeOnDelete(boolean shouldCascadeOnDelete)
public void setSourceFields(java.util.List<java.lang.String> sourceFields)
public void setTargetFields(java.util.List<java.lang.String> targetFields)
public void setTargetTable(java.lang.String targetTable)
public boolean shouldCascadeOnDelete()