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.
- Author:
- Gavin King
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddReferencedColumns(List<Column> referencedColumns) voidValidates that column span of the foreign key and the primary key is the same.voidDeprecated, 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 keybooleanDeprecated.booleanbooleanbooleanDoes this foreignkey reference the primary key of the reference tableresolveReferencedClass(Metadata metadata) voidsetCascadeDeleteEnabled(boolean cascadeDeleteEnabled) Deprecated.voidsetKeyDefinition(String keyDefinition) voidvoidsetOnDeleteAction(OnDeleteAction onDeleteAction) voidsetReferencedEntityName(String referencedEntityName) voidsetReferencedTable(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:ExportableGet 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:
setNamein 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:
sqlConstraintStringin 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:
toStringin classConstraint
-
generatedConstraintNamePrefix
Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
generatedConstraintNamePrefixin classConstraint- Returns:
- String The prefix to use in generated constraint names. Examples: "UK_", "FK_", and "PK_".
-
resolveReferencedClass
-
getOnDeleteAction()