Class ForeignKeyConstraint
- java.lang.Object
-
- org.eclipse.persistence.tools.schemaframework.ForeignKeyConstraint
-
- All Implemented Interfaces:
java.io.Serializable
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.
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field 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 Summary
Constructors Constructor Description ForeignKeyConstraint()
ForeignKeyConstraint(java.lang.String name, java.lang.String sourceField, java.lang.String targetField, java.lang.String targetTable)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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()
-
-
-
Field Detail
-
name
protected java.lang.String name
-
sourceFields
protected java.util.List<java.lang.String> sourceFields
-
targetFields
protected java.util.List<java.lang.String> targetFields
-
targetTable
protected java.lang.String targetTable
-
shouldCascadeOnDelete
protected boolean shouldCascadeOnDelete
-
foreignKeyDefinition
protected java.lang.String foreignKeyDefinition
-
disableForeignKey
protected boolean disableForeignKey
-
-
Method Detail
-
addSourceField
public void addSourceField(java.lang.String sourceField)
-
addTargetField
public void addTargetField(java.lang.String targetField)
-
appendDBString
public 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.
-
cascadeOnDelete
public void cascadeOnDelete()
PUBLIC: Enables delete cascading on the database. This must be used carefully, i.e. only private relationships.
-
disableForeignKey
public boolean disableForeignKey()
-
dontCascadeOnDelete
public void dontCascadeOnDelete()
PUBLIC: Disables delete cascading on the database, this is the default.
-
getForeignKeyDefinition
public java.lang.String getForeignKeyDefinition()
-
getName
public java.lang.String getName()
-
getSourceFields
public java.util.List<java.lang.String> getSourceFields()
-
getTargetFields
public java.util.List<java.lang.String> getTargetFields()
-
getTargetTable
public java.lang.String getTargetTable()
-
hasForeignKeyDefinition
public boolean hasForeignKeyDefinition()
-
isDisableForeignKey
public boolean isDisableForeignKey()
-
setDisableForeignKey
public void setDisableForeignKey(boolean disableForeignKey)
-
setForeignKeyDefinition
public void setForeignKeyDefinition(java.lang.String foreignKeyDefinition)
-
setName
public void setName(java.lang.String name)
-
setShouldCascadeOnDelete
public void setShouldCascadeOnDelete(boolean shouldCascadeOnDelete)
PUBLIC: Enables delete cascading on the database. This must be used carefully, i.e. only private relationships.
-
setSourceFields
public void setSourceFields(java.util.List<java.lang.String> sourceFields)
-
setTargetFields
public void setTargetFields(java.util.List<java.lang.String> targetFields)
-
setTargetTable
public void setTargetTable(java.lang.String targetTable)
-
shouldCascadeOnDelete
public boolean shouldCascadeOnDelete()
-
-