Package org.hibernate.mapping
Class ForeignKey
java.lang.Object
org.hibernate.mapping.Constraint
org.hibernate.mapping.ForeignKey
- All Implemented Interfaces:
Serializable,RelationalModel
A foreign key constraint
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddReferencedColumns(Iterator referencedColumnsIterator) voidValidates that columnspan of the foreignkey and the primarykey is the same.Returns the referenced columns if the foreignkey does not refer to the primary keybooleanbooleanbooleanDoes this foreignkey reference the primary key of the reference tablevoidsetCascadeDeleteEnabled(boolean cascadeDeleteEnabled) voidsetReferencedEntityName(String referencedEntityName) voidsetReferencedTable(Table referencedTable) sqlConstraintString(Dialect dialect, String constraintName, String defaultCatalog, String defaultSchema) sqlDropString(Dialect dialect, String defaultCatalog, String defaultSchema) toString()Methods inherited from class org.hibernate.mapping.Constraint
addColumn, addColumns, columnIterator, containsColumn, getColumn, getColumnIterator, getColumns, getColumnSpan, getName, getTable, isGenerated, setName, setTable, sqlCreateString
-
Constructor Details
-
ForeignKey
public ForeignKey()
-
-
Method Details
-
sqlConstraintString
public String sqlConstraintString(Dialect dialect, String constraintName, String defaultCatalog, String defaultSchema) - Specified by:
sqlConstraintStringin classConstraint
-
getReferencedTable
-
setReferencedTable
- Throws:
MappingException
-
alignColumns
public void alignColumns()Validates that columnspan of the foreignkey and the primarykey is the same. Furthermore it aligns the length of the underlying tables columns.- Parameters:
referencedTable-
-
getReferencedEntityName
-
setReferencedEntityName
-
sqlDropString
- Specified by:
sqlDropStringin interfaceRelationalModel- Overrides:
sqlDropStringin classConstraint
-
isCascadeDeleteEnabled
public boolean isCascadeDeleteEnabled() -
setCascadeDeleteEnabled
public void setCascadeDeleteEnabled(boolean cascadeDeleteEnabled) -
isPhysicalConstraint
public boolean isPhysicalConstraint() -
getReferencedColumns
Returns the referenced columns if the foreignkey does not refer to the primary key -
isReferenceToPrimaryKey
public boolean isReferenceToPrimaryKey()Does this foreignkey reference the primary key of the reference table -
addReferencedColumns
-
toString
- Overrides:
toStringin classConstraint
-