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
-
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
Deprecated, for removal: This API element is subject to removal in a future version.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
Deprecated.boolean
boolean
boolean
Does this foreignkey reference the primary key of the reference tableresolveReferencedClass
(Metadata metadata) void
setCascadeDeleteEnabled
(boolean cascadeDeleteEnabled) Deprecated.void
setKeyDefinition
(String keyDefinition) void
void
setOnDeleteAction
(OnDeleteAction onDeleteAction) void
setReferencedEntityName
(String referencedEntityName) void
setReferencedTable
(Table referencedTable) sqlConstraintString
(SqlStringGenerationContext context, String constraintName, String defaultCatalog, String defaultSchema) Deprecated, for removal: This API element is subject to removal in a future version.toString()
Methods inherited from class org.hibernate.mapping.Constraint
addColumn, addColumns, containsColumn, generateName, generateName, getColumn, getColumns, getColumnSpan, getName, getTable, hashedName, isGenerated, setTable
-
Constructor Details
-
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
-
sqlConstraintString
@Deprecated(since="6.2", forRemoval=true) public String sqlConstraintString(SqlStringGenerationContext context, String constraintName, String defaultCatalog, String defaultSchema) Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
sqlConstraintString
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
-
isCascadeDeleteEnabled
Deprecated. -
setCascadeDeleteEnabled
Deprecated. -
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
-
generatedConstraintNamePrefix
Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
generatedConstraintNamePrefix
in classConstraint
- Returns:
- String The prefix to use in generated constraint names. Examples: "UK_", "FK_", and "PK_".
-
resolveReferencedClass
-
getOnDeleteAction()