Package org.hibernate.mapping
Class ForeignKey
java.lang.Object
org.hibernate.mapping.Constraint
org.hibernate.mapping.ForeignKey
- All Implemented Interfaces:
Serializable
,Exportable
A mapping model object representing a foreign key constraint.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addReferencedColumns
(List<Column> referencedColumns) void
Validates that column span of the foreign key and the primary key is the same.void
Get a unique identifier to make sure we are not exporting the same database structure multiple times.Returns the referenced columns if the foreignkey does not refer to the primary keyboolean
boolean
boolean
Does this foreignkey reference the primary key of the reference tableresolveReferencedClass
(Metadata metadata) void
setKeyDefinition
(String keyDefinition) void
void
setOnDeleteAction
(OnDeleteAction onDeleteAction) void
setReferencedEntityName
(String referencedEntityName) void
setReferencedTable
(Table referencedTable) toString()
Methods inherited from class org.hibernate.mapping.Constraint
addColumn, addColumns, containsColumn, getColumn, getColumns, getColumnSpan, getName, getOptions, getTable, setOptions, setTable
-
Constructor Details
-
ForeignKey
-
ForeignKey
public ForeignKey()
-
-
Method Details
-
getExportIdentifier
Description copied from interface:Exportable
Get a unique identifier to make sure we are not exporting the same database structure multiple times.- Returns:
- The exporting identifier.
-
disableCreation
public void disableCreation() -
isCreationEnabled
public boolean isCreationEnabled() -
setName
- Overrides:
setName
in classConstraint
-
getReferencedTable
-
setReferencedTable
- Throws:
MappingException
-
alignColumns
public void alignColumns()Validates that column span of the foreign key and the primary key is the same.Furthermore it aligns the length of the underlying tables columns.
-
getReferencedEntityName
-
setReferencedEntityName
-
getKeyDefinition
-
setKeyDefinition
-
setOnDeleteAction
-
getOnDeleteAction
-
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:
toString
in classConstraint
-
resolveReferencedClass
-