org.hibernate.metamodel.relational
Class ForeignKey

java.lang.Object
  extended by org.hibernate.metamodel.relational.AbstractConstraint
      extended by org.hibernate.metamodel.relational.ForeignKey
All Implemented Interfaces:
Constraint, Exportable

public class ForeignKey
extends AbstractConstraint
implements Constraint, Exportable

Models the notion of a foreign key.

Note that this need not mean a physical foreign key; we just mean a relationship between 2 table specifications.


Nested Class Summary
static class ForeignKey.ReferentialAction
           
 
Constructor Summary
protected ForeignKey(TableSpecification sourceTable, TableSpecification targetTable)
           
protected ForeignKey(TableSpecification sourceTable, TableSpecification targetTable, String name)
           
 
Method Summary
 void addColumn(Column column)
           
 void addColumnMapping(Column sourceColumn, Column targetColumn)
           
 ForeignKey.ReferentialAction getDeleteRule()
           
 String getExportIdentifier()
          Get a unique identifier to make sure we are not exporting the same database structure multiple times.
 Iterable<Column> getSourceColumns()
           
 TableSpecification getSourceTable()
           
 Iterable<Column> getTargetColumns()
           
 TableSpecification getTargetTable()
           
 ForeignKey.ReferentialAction getUpdateRule()
           
 void setDeleteRule(ForeignKey.ReferentialAction deleteRule)
           
 void setUpdateRule(ForeignKey.ReferentialAction updateRule)
           
 String sqlConstraintStringInAlterTable(Dialect dialect)
           
 String[] sqlDropStrings(Dialect dialect)
          Gets the SQL strings for dropping the database object.
 
Methods inherited from class org.hibernate.metamodel.relational.AbstractConstraint
getColumns, getColumnSpan, getName, getTable, internalAddColumn, internalColumnAccess, isCreationVetoed, sqlCreateStrings
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.hibernate.metamodel.relational.Constraint
getColumns, getName, getTable
 
Methods inherited from interface org.hibernate.metamodel.relational.Exportable
sqlCreateStrings
 

Constructor Detail

ForeignKey

protected ForeignKey(TableSpecification sourceTable,
                     TableSpecification targetTable,
                     String name)

ForeignKey

protected ForeignKey(TableSpecification sourceTable,
                     TableSpecification targetTable)
Method Detail

getSourceTable

public TableSpecification getSourceTable()

getTargetTable

public TableSpecification getTargetTable()

getSourceColumns

public Iterable<Column> getSourceColumns()

getTargetColumns

public Iterable<Column> getTargetColumns()

addColumn

public void addColumn(Column column)
Overrides:
addColumn in class AbstractConstraint

addColumnMapping

public void addColumnMapping(Column sourceColumn,
                             Column targetColumn)

getExportIdentifier

public String getExportIdentifier()
Description copied from interface: Exportable
Get a unique identifier to make sure we are not exporting the same database structure multiple times.

Specified by:
getExportIdentifier in interface Exportable
Returns:
The exporting identifier.

getDeleteRule

public ForeignKey.ReferentialAction getDeleteRule()

setDeleteRule

public void setDeleteRule(ForeignKey.ReferentialAction deleteRule)

getUpdateRule

public ForeignKey.ReferentialAction getUpdateRule()

setUpdateRule

public void setUpdateRule(ForeignKey.ReferentialAction updateRule)

sqlDropStrings

public String[] sqlDropStrings(Dialect dialect)
Description copied from interface: Exportable
Gets the SQL strings for dropping the database object.

Specified by:
sqlDropStrings in interface Exportable
Overrides:
sqlDropStrings in class AbstractConstraint
Parameters:
dialect - The dialect for which to generate the SQL drop strings
Returns:
the SQL strings for dropping the database object.

sqlConstraintStringInAlterTable

public String sqlConstraintStringInAlterTable(Dialect dialect)
Specified by:
sqlConstraintStringInAlterTable in class AbstractConstraint


Copyright © 2001-2012 Red Hat, Inc. All Rights Reserved.