public class ForeignKey extends Object
| Constructor and Description |
|---|
ForeignKey(JdbcAdaptor jdbcAdaptor,
Mapping<?,?,?> mapping,
List<JoinColumnMetadata> metadata)
Constructor to create a join foreign key
|
ForeignKey(JdbcAdaptor jdbcAdaptor,
Mapping<?,?,?> mapping,
List<JoinColumnMetadata> metadata,
boolean inverseOwner)
Constructor to create a join foreign key
|
ForeignKey(JdbcAdaptor jdbcAdaptor,
SecondaryTable table,
EntityTypeDescriptor entity,
List<PrimaryKeyJoinColumnMetadata> metadata) |
| Modifier and Type | Method and Description |
|---|---|
String |
createDestinationJoin(javax.persistence.criteria.JoinType joinType,
String parentAlias,
String alias)
Creates the join for destination foreign keys.
|
String |
createSourceJoin(javax.persistence.criteria.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.
|
Mapping<?,?,?> |
getMapping()
Returns the mapping of the ForeignKey.
|
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.
|
String |
getReferencedTableQName()
Returns the qualified referenced table of the foreign key.
|
AbstractTable |
getTable()
Returns the table of the ForeignKey.
|
boolean |
isReadOnly()
Returns if the foreign key maps to a readonly join.
|
void |
link(AssociationMapping<?,?,?> mapping,
EntityTypeDescriptor targetEntity)
Links the foreign key.
|
void |
performAttachChild(Connection connection,
Object instance,
Joinable[] batch,
int size)
Attaches the child to the managed instance.
|
void |
performDetachAll(Connection connection,
Object instance)
Detaches the instance from all the children.
|
void |
performDetachChild(Connection connection,
Object key,
Object child)
Detaches the child.
|
void |
setOrderColumn(ColumnMetadata orderColumn,
String name,
AbstractLocator locator)
Sets the order column.
|
void |
setTable(AbstractTable table)
Sets the table of the foreign key.
|
String |
toString() |
public ForeignKey(JdbcAdaptor jdbcAdaptor, Mapping<?,?,?> mapping, List<JoinColumnMetadata> metadata)
jdbcAdaptor - the JDBC Adaptormapping - the owner mappingmetadata - the metadata for join columnpublic ForeignKey(JdbcAdaptor jdbcAdaptor, Mapping<?,?,?> mapping, List<JoinColumnMetadata> metadata, boolean inverseOwner)
jdbcAdaptor - the JDBC Adaptormapping - the owner mappingmetadata - the metadata for join columninverseOwner - true if the foreign key is inverse ownerpublic ForeignKey(JdbcAdaptor jdbcAdaptor, SecondaryTable table, EntityTypeDescriptor entity, List<PrimaryKeyJoinColumnMetadata> metadata)
jdbcAdaptor - the JDBC Adaptortable - the secondary tableentity - the entitymetadata - the metadatapublic String createDestinationJoin(javax.persistence.criteria.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(javax.persistence.criteria.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 Mapping<?,?,?> getMapping()
public String getName()
public OrderColumn getOrderColumn()
public String getReferencedTableName()
public String getReferencedTableQName()
public AbstractTable getTable()
public boolean isReadOnly()
public void link(AssociationMapping<?,?,?> mapping, EntityTypeDescriptor targetEntity)
mapping - the owner attributetargetEntity - the target entitypublic void performAttachChild(Connection connection, Object instance, Joinable[] batch, int size) throws SQLException
connection - the connectioninstance - the instancebatch - the batch of joinablessize - the size of the batchSQLException - thrown in case of an SQL errorpublic void performDetachAll(Connection connection, Object instance) throws SQLException
connection - the connectioninstance - the instanceSQLException - thrown in case of an SQL errorpublic void performDetachChild(Connection 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, AbstractLocator locator)
orderColumn - the order columnname - the name of the columnlocator - the locatorpublic void setTable(AbstractTable table)
table - the tableCopyright © 2012-2013 Batoo. All Rights Reserved.