类 ForeignKey
- java.lang.Object
-
- org.hibernate.mapping.Constraint
-
- org.hibernate.mapping.ForeignKey
-
- 所有已实现的接口:
Serializable,Exportable,RelationalModel
public class ForeignKey extends Constraint
A foreign key constraint- 作者:
- Gavin King
- 另请参阅:
- 序列化表格
-
-
构造器概要
构造器 构造器 说明 ForeignKey()
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 voidaddReferencedColumns(Iterator referencedColumnsIterator)voidalignColumns()Validates that columnspan of the foreignkey and the primarykey is the same.voiddisableCreation()StringgeneratedConstraintNamePrefix()StringgetExportIdentifier()Get a unique identifier to make sure we are not exporting the same database structure multiple times.StringgetKeyDefinition()ListgetReferencedColumns()Returns the referenced columns if the foreignkey does not refer to the primary keyStringgetReferencedEntityName()TablegetReferencedTable()booleanisCascadeDeleteEnabled()booleanisCreationEnabled()booleanisPhysicalConstraint()booleanisReferenceToPrimaryKey()Does this foreignkey reference the primary key of the reference tablevoidsetCascadeDeleteEnabled(boolean cascadeDeleteEnabled)voidsetKeyDefinition(String keyDefinition)voidsetName(String name)voidsetReferencedEntityName(String referencedEntityName)voidsetReferencedTable(Table referencedTable)StringsqlConstraintString(Dialect dialect, String constraintName, String defaultCatalog, String defaultSchema)StringsqlDropString(Dialect dialect, String defaultCatalog, String defaultSchema)StringtoString()-
从类继承的方法 org.hibernate.mapping.Constraint
addColumn, addColumns, columnIterator, containsColumn, generateName, generateName, getColumn, getColumnIterator, getColumns, getColumnSpan, getName, getTable, hashedName, isGenerated, setTable, sqlCreateString
-
-
-
-
方法详细资料
-
getExportIdentifier
public String getExportIdentifier()
从接口复制的说明:ExportableGet a unique identifier to make sure we are not exporting the same database structure multiple times.- 返回:
- The exporting identifier.
-
disableCreation
public void disableCreation()
-
isCreationEnabled
public boolean isCreationEnabled()
-
setName
public void setName(String name)
- 覆盖:
setName在类中Constraint
-
sqlConstraintString
public String sqlConstraintString(Dialect dialect, String constraintName, String defaultCatalog, String defaultSchema)
- 指定者:
sqlConstraintString在类中Constraint
-
getReferencedTable
public Table getReferencedTable()
-
setReferencedTable
public void setReferencedTable(Table referencedTable) throws MappingException
- 抛出:
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.
-
getReferencedEntityName
public String getReferencedEntityName()
-
setReferencedEntityName
public void setReferencedEntityName(String referencedEntityName)
-
getKeyDefinition
public String getKeyDefinition()
-
setKeyDefinition
public void setKeyDefinition(String keyDefinition)
-
sqlDropString
public String sqlDropString(Dialect dialect, String defaultCatalog, String defaultSchema)
- 指定者:
sqlDropString在接口中RelationalModel- 覆盖:
sqlDropString在类中Constraint
-
isCascadeDeleteEnabled
public boolean isCascadeDeleteEnabled()
-
setCascadeDeleteEnabled
public void setCascadeDeleteEnabled(boolean cascadeDeleteEnabled)
-
isPhysicalConstraint
public boolean isPhysicalConstraint()
-
getReferencedColumns
public 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(Iterator referencedColumnsIterator)
-
toString
public String toString()
- 覆盖:
toString在类中Constraint
-
generatedConstraintNamePrefix
public String generatedConstraintNamePrefix()
- 指定者:
generatedConstraintNamePrefix在类中Constraint- 返回:
- String The prefix to use in generated constraint names. Examples: "UK_", "FK_", and "PK_".
-
-