Top Description Fields Constructors Methods
org.hibernate.mapping

public Class ForeignKey

extends Constraint
Class Inheritance
Imports
java.util.ArrayList, .Iterator, .List, org.hibernate.MappingException, org.hibernate.boot.model.relational.SqlStringGenerationContext, org.hibernate.dialect.Dialect, org.hibernate.internal.util.StringHelper

Deprecated

as a consequence of Constraint being deprecated. See corresponding docs for further information.

A foreign key constraint
Author
Gavin King

Field Summary

Modifier and TypeField and Description
private boolean
private boolean
private String
private List<Column>
private String
private Table
referencedTable

Deprecated as a consequence of Table being deprecated.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private void
public void
addReferencedColumns(Iterator<E> referencedColumnsIterator)

public void
alignColumns()

Validates that column span of the foreign key and the primary key is the same.

private void
alignColumns(Table referencedTable)

Deprecated as a consequence of Table being deprecated.
private void
public void
public String
public String
getExportIdentifier()

Implements org.hibernate.boot.model.relational.Exportable.getExportIdentifier.

Get a unique identifier to make sure we are not exporting the same database structure multiple times.
public String
public List<E>
getReferencedColumns()

Returns the referenced columns if the foreignkey does not refer to the primary key

public String
public Table
getReferencedTable()

Deprecated as a consequence of Table being deprecated.
public boolean
public boolean
public boolean
public boolean
isReferenceToPrimaryKey()

Does this foreignkey reference the primary key of the reference table

public void
setCascadeDeleteEnabled(boolean cascadeDeleteEnabled)

public void
setKeyDefinition(String keyDefinition)

public void
public void
setReferencedEntityName(String referencedEntityName)

public void
setReferencedTable(Table referencedTable)

Deprecated as a consequence of Table being deprecated.
public String
sqlConstraintString(SqlStringGenerationContext context, String constraintName, String defaultCatalog, String defaultSchema)

Implements abstract org.hibernate.mapping.Constraint.sqlConstraintString.

public String
public String
toString()

Overrides org.hibernate.mapping.Constraint.toString.

Returns a string representation of the object.
Inherited from org.hibernate.mapping.Constraint:
addColumnaddColumnscolumnIteratorcontainsColumngenerateNamegenerateNamegetColumngetColumnIteratorgetColumnsgetColumnSpangetNamegetTablehashedNameisGeneratedsetTablesqlCreateString

Field Detail

cascadeDeleteEnabledback to summary
private boolean cascadeDeleteEnabled
creationEnabledback to summary
private boolean creationEnabled
keyDefinitionback to summary
private String keyDefinition
referencedColumnsback to summary
private List<Column> referencedColumns
referencedEntityNameback to summary
private String referencedEntityName
referencedTableback to summary
private Table referencedTable

Deprecated

as a consequence of Table being deprecated. See corresponding docs for further information.

Constructor Detail

ForeignKeyback to summary
public ForeignKey()

Method Detail

addReferencedColumnback to summary
private void addReferencedColumn(Column column)
addReferencedColumnsback to summary
public void addReferencedColumns(Iterator<E> referencedColumnsIterator)
alignColumnsback to summary
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.

alignColumnsback to summary
private void alignColumns(Table referencedTable)

Deprecated

as a consequence of Table being deprecated. See corresponding docs for further information.

appendColumnsback to summary
private void appendColumns(StringBuilder buf, Iterator<E> columns)
disableCreationback to summary
public void disableCreation()
generatedConstraintNamePrefixback to summary
public String generatedConstraintNamePrefix()

Implements abstract org.hibernate.mapping.Constraint.generatedConstraintNamePrefix.

Returns:String

Doc from org.hibernate.mapping.Constraint.generatedConstraintNamePrefix.

String The prefix to use in generated constraint names. Examples: "UK_", "FK_", and "PK_".

getExportIdentifierback to summary
public String getExportIdentifier()

Implements org.hibernate.boot.model.relational.Exportable.getExportIdentifier.

Doc from org.hibernate.boot.model.relational.Exportable.getExportIdentifier.

Get a unique identifier to make sure we are not exporting the same database structure multiple times.

Returns:String

The exporting identifier.

Annotations
@Override
getKeyDefinitionback to summary
public String getKeyDefinition()
getReferencedColumnsback to summary
public List<E> getReferencedColumns()

Returns the referenced columns if the foreignkey does not refer to the primary key

getReferencedEntityNameback to summary
public String getReferencedEntityName()
getReferencedTableback to summary
public Table getReferencedTable()

Deprecated

as a consequence of Table being deprecated. See corresponding docs for further information.

isCascadeDeleteEnabledback to summary
public boolean isCascadeDeleteEnabled()
isCreationEnabledback to summary
public boolean isCreationEnabled()
isPhysicalConstraintback to summary
public boolean isPhysicalConstraint()
isReferenceToPrimaryKeyback to summary
public boolean isReferenceToPrimaryKey()

Does this foreignkey reference the primary key of the reference table

setCascadeDeleteEnabledback to summary
public void setCascadeDeleteEnabled(boolean cascadeDeleteEnabled)
setKeyDefinitionback to summary
public void setKeyDefinition(String keyDefinition)
setNameback to summary
public void setName(String name)

Overrides org.hibernate.mapping.Constraint.setName.

Annotations
@Override
setReferencedEntityNameback to summary
public void setReferencedEntityName(String referencedEntityName)
setReferencedTableback to summary
public void setReferencedTable(Table referencedTable) throws MappingException

Deprecated

as a consequence of Table being deprecated. See corresponding docs for further information.

sqlConstraintStringback to summary
public String sqlConstraintString(SqlStringGenerationContext context, String constraintName, String defaultCatalog, String defaultSchema)

Implements abstract org.hibernate.mapping.Constraint.sqlConstraintString.

Annotations
@Override
sqlDropStringback to summary
public String sqlDropString(SqlStringGenerationContext context, String defaultCatalog, String defaultSchema)

Overrides org.hibernate.mapping.Constraint.sqlDropString.

Implements org.hibernate.mapping.RelationalModel.sqlDropString.

Annotations
@Override
toStringback to summary
public String toString()

Overrides org.hibernate.mapping.Constraint.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.