org.hibernate.mapping
Class ForeignKey
java.lang.Object
org.hibernate.mapping.Constraint
org.hibernate.mapping.ForeignKey
- All Implemented Interfaces:
- java.io.Serializable, RelationalModel
public class ForeignKey
- extends Constraint
A foreign key constraint
- Author:
- Gavin King
- See Also:
- Serialized Form
Methods inherited from class org.hibernate.mapping.Constraint |
addColumn, addColumns, columnIterator, containsColumn, getColumn, getColumnIterator, getColumns, getColumnSpan, getName, getTable, isGenerated, setName, setTable, sqlCreateString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
ForeignKey
public ForeignKey()
sqlConstraintString
public java.lang.String sqlConstraintString(Dialect dialect,
java.lang.String constraintName,
java.lang.String defaultCatalog,
java.lang.String defaultSchema)
- Specified by:
sqlConstraintString
in class Constraint
getReferencedTable
public Table getReferencedTable()
setReferencedTable
public void setReferencedTable(Table referencedTable)
throws MappingException
- 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
public java.lang.String getReferencedEntityName()
setReferencedEntityName
public void setReferencedEntityName(java.lang.String referencedEntityName)
sqlDropString
public java.lang.String sqlDropString(Dialect dialect,
java.lang.String defaultCatalog,
java.lang.String defaultSchema)
- Specified by:
sqlDropString
in interface RelationalModel
- Overrides:
sqlDropString
in class Constraint
isCascadeDeleteEnabled
public boolean isCascadeDeleteEnabled()
setCascadeDeleteEnabled
public void setCascadeDeleteEnabled(boolean cascadeDeleteEnabled)
isPhysicalConstraint
public boolean isPhysicalConstraint()
getReferencedColumns
public java.util.List 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
public void addReferencedColumns(java.util.Iterator referencedColumnsIterator)
toString
public java.lang.String toString()
- Overrides:
toString
in class Constraint
Copyright © 2008 Hibernate.org. All Rights Reserved.