public class ForeignKey extends Object
| Constructor and Description |
|---|
ForeignKey(JdbcAdaptor jdbcAdaptor,
List<JoinColumnMetadata> metadata)
Constructor to create a join foreign key
|
ForeignKey(JdbcAdaptor jdbcAdaptor,
List<JoinColumnMetadata> metadata,
boolean inverseOwner)
Constructor to create a join foreign key
|
ForeignKey(JdbcAdaptor jdbcAdaptor,
SecondaryTable table,
EntityTypeImpl<?> entity,
List<PrimaryKeyJoinColumnMetadata> metadata) |
| Modifier and Type | Method and Description |
|---|---|
String |
createDestinationJoin(JoinType joinType,
String parentAlias,
String alias)
Creates the join for destination foreign keys.
|
String |
createSourceJoin(JoinType joinType,
String parentAlias,
String alias)
Creates the join for source foreign keys.
|
List<JoinColumn> |
getJoinColumns()
Returns the list of join columns of the foreign key.
|
String |
getName()
Returns a generated name for the foreign key.
|
OrderColumn |
getOrderColumn()
Returns the order column.
|
String |
getReferencedTableName()
Returns the referenced table of the foreign key.
|
AbstractTable |
getTable()
Returns the table of the ForeignKey.
|
void |
link(AssociationMapping<?,?,?> mapping,
EntityTypeImpl<?> targetEntity)
Links the foreign key.
|
void |
performAttachChild(ConnectionImpl connection,
ManagedInstance<?> instance,
Object key,
Object child,
int index)
Attaches the child to the managed instance.
|
void |
performDetachAll(ConnectionImpl connection,
ManagedInstance<?> instance)
Detaches the instance from all the children.
|
void |
performDetachChild(ConnectionImpl connection,
Object key,
Object child)
Detaches the child.
|
void |
setOrderColumn(ColumnMetadata orderColumn,
String name)
Sets the order column.
|
void |
setTable(AbstractTable table)
Sets the table of the foreign key.
|
String |
toString() |
public ForeignKey(JdbcAdaptor jdbcAdaptor, List<JoinColumnMetadata> metadata)
jdbcAdaptor - the JDBC Adaptormetadata - the metadata for join columnpublic ForeignKey(JdbcAdaptor jdbcAdaptor, List<JoinColumnMetadata> metadata, boolean inverseOwner)
jdbcAdaptor - the JDBC Adaptormetadata - the metadata for join columninverseOwner - true if the foreign key is inverse ownerpublic ForeignKey(JdbcAdaptor jdbcAdaptor, SecondaryTable table, EntityTypeImpl<?> entity, List<PrimaryKeyJoinColumnMetadata> metadata)
jdbcAdaptor - the JDBC Adaptortable - the secondary tableentity - the entitymetadata - the metadatapublic String createDestinationJoin(JoinType joinType, String parentAlias, String alias)
joinType - the type of the joinparentAlias - the alias of the parent tablealias - the alias of the tablepublic String createSourceJoin(JoinType joinType, String parentAlias, String alias)
joinType - the type of the joinparentAlias - the alias of the parent tablealias - the alias of the tablepublic List<JoinColumn> getJoinColumns()
public String getName()
public OrderColumn getOrderColumn()
public String getReferencedTableName()
public AbstractTable getTable()
public void link(AssociationMapping<?,?,?> mapping, EntityTypeImpl<?> targetEntity)
mapping - the owner attributetargetEntity - the target entitypublic void performAttachChild(ConnectionImpl connection, ManagedInstance<?> instance, Object key, Object child, int index) throws SQLException
connection - the connectioninstance - the instancekey - the key objectchild - the childindex - the indexSQLException - thrown in case of an SQL errorpublic void performDetachAll(ConnectionImpl connection, ManagedInstance<?> instance) throws SQLException
connection - the connectioninstance - the instanceSQLException - thrown in case of an SQL errorpublic void performDetachChild(ConnectionImpl connection, Object key, Object child) throws SQLException
connection - the connectionkey - the key objectchild - the childSQLException - thrown in case of an SQL errorpublic void setOrderColumn(ColumnMetadata orderColumn, String name)
orderColumn - the order columnname - the name of the columnpublic void setTable(AbstractTable table)
table - the tableCopyright © 2012 Batoo Software & Consultancy. All Rights Reserved.