org.eclipse.persistence.mappings
Class RelationTableMechanism

java.lang.Object
  extended by org.eclipse.persistence.mappings.RelationTableMechanism
All Implemented Interfaces:
java.lang.Cloneable

public class RelationTableMechanism
extends java.lang.Object
implements java.lang.Cloneable

Purpose: Contains relation table functionality that was originally defined in ManyToManyMapping and now is shared with OneToOneMapping.


Constructor Summary
RelationTableMechanism()
           
 
Method Summary
 org.eclipse.persistence.internal.sessions.AbstractRecord addRelationTableSourceRow(org.eclipse.persistence.internal.sessions.AbstractRecord sourceRow, org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow)
          INTERNAL: Add to a row source relation fields with values extracted from the source row.
 org.eclipse.persistence.internal.sessions.AbstractRecord addRelationTableSourceRow(java.lang.Object sourceObject, org.eclipse.persistence.internal.sessions.AbstractSession session, org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow, ForeignReferenceMapping mapping)
          INTERNAL: Add to a row source relation fields with values extracted from the source object.
 org.eclipse.persistence.internal.sessions.AbstractRecord addRelationTableTargetRow(java.lang.Object targetObject, org.eclipse.persistence.internal.sessions.AbstractSession session, org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow, ForeignReferenceMapping mapping)
          INTERNAL: Add to a row target relation fields with values extracted from the target object.
 void addSourceRelationKeyField(org.eclipse.persistence.internal.helper.DatabaseField sourceRelationKeyField, org.eclipse.persistence.internal.helper.DatabaseField sourcePrimaryKeyField)
          PUBLIC: Add the fields in the intermediate table that corresponds to the primary key in the source table.
 void addSourceRelationKeyFieldName(java.lang.String sourceRelationKeyFieldName, java.lang.String sourcePrimaryKeyFieldName)
          PUBLIC: Add the fields in the intermediate table that corresponds to the primary key in the source table.
 void addTargetRelationKeyField(org.eclipse.persistence.internal.helper.DatabaseField targetRelationKeyField, org.eclipse.persistence.internal.helper.DatabaseField targetPrimaryKeyField)
          PUBLIC: Add the fields in the intermediate table that corresponds to the primary key in the target table.
 void addTargetRelationKeyFieldName(java.lang.String targetRelationKeyFieldName, java.lang.String targetPrimaryKeyFieldName)
          PUBLIC: Add the fields in the intermediate table that corresponds to the primary key in the target table.
 org.eclipse.persistence.internal.sessions.AbstractRecord buildRelationTableSourceAndTargetRow(org.eclipse.persistence.internal.sessions.AbstractRecord sourceRow, java.lang.Object targetObject, org.eclipse.persistence.internal.sessions.AbstractSession session, ForeignReferenceMapping mapping)
          INTERNAL: Create a row that contains source relation fields with values extracted from the source row and target relation fields with values extracted from the target object.
 org.eclipse.persistence.internal.sessions.AbstractRecord buildRelationTableSourceAndTargetRow(java.lang.Object sourceObject, java.lang.Object targetObject, org.eclipse.persistence.internal.sessions.AbstractSession session, ForeignReferenceMapping mapping)
          INTERNAL: Create a row that contains source relation fields with values extracted from the source object and target relation fields with values extracted from the target object.
 org.eclipse.persistence.internal.sessions.AbstractRecord buildRelationTableSourceRow(org.eclipse.persistence.internal.sessions.AbstractRecord sourceRow)
          INTERNAL: Create a row that contains source relation fields with values extracted from the source row.
 org.eclipse.persistence.internal.sessions.AbstractRecord buildRelationTableSourceRow(java.lang.Object sourceObject, org.eclipse.persistence.internal.sessions.AbstractSession session, ForeignReferenceMapping mapping)
          INTERNAL: Create a row that contains source relation fields with values extracted from the source object.
 java.lang.Object clone()
          INTERNAL: The mapping clones itself to create deep copy.
 org.eclipse.persistence.internal.helper.DatabaseTable getRelationTable()
          INTERNAL: Return the relation table associated with the mapping.
 java.lang.String getRelationTableName()
          PUBLIC: Return the relation table name associated with the mapping.
 java.lang.String getRelationTableQualifiedName()
          PUBLIC: Return the relation table qualified name associated with the mapping.
 java.util.Vector getSourceKeyFieldNames()
          PUBLIC: Return the source key field names associated with the mapping.
 java.util.Vector<org.eclipse.persistence.internal.helper.DatabaseField> getSourceKeyFields()
          INTERNAL: Return all the source key fields associated with the mapping.
 java.util.Vector getSourceRelationKeyFieldNames()
          PUBLIC: Return the source relation key field names associated with the mapping.
 java.util.Vector<org.eclipse.persistence.internal.helper.DatabaseField> getSourceRelationKeyFields()
          INTERNAL: Return all the source relation key fields associated with the mapping.
 java.util.Vector getTargetKeyFieldNames()
          PUBLIC: Return the target key field names associated with the mapping.
 java.util.Vector<org.eclipse.persistence.internal.helper.DatabaseField> getTargetKeyFields()
          INTERNAL: Return all the target keys associated with the mapping.
 java.util.Vector getTargetRelationKeyFieldNames()
          PUBLIC: Return the target relation key field names associated with the mapping.
 java.util.Vector<org.eclipse.persistence.internal.helper.DatabaseField> getTargetRelationKeyFields()
          INTERNAL: Return all the target relation key fields associated with the mapping.
 boolean hasRelationTable()
          INTERNAL: Indicates whether the mechanism has relation table.
 void initialize(org.eclipse.persistence.internal.sessions.AbstractSession session, ForeignReferenceMapping mapping)
          INTERNAL: Initialize
 Expression joinRelationTableField(Expression expression, Expression baseExpression)
          INTERNAL: Adds to the passed expression a single relation table field joined to source field.
 void setCustomDeleteQuery(DataModifyQuery query)
          PUBLIC: The default delete query for mapping can be overridden by specifying the new query.
 void setCustomInsertQuery(DataModifyQuery query)
          PUBLIC: The default insert query for mapping can be overridden by specifying the new query.
 void setDeleteCall(Call call)
          PUBLIC: Set the receiver's delete Call.
 void setDeleteSQLString(java.lang.String sqlString)
          PUBLIC: Set the receiver's delete SQL string.
 void setInsertCall(Call call)
          PUBLIC: Set the receiver's insert Call.
 void setInsertSQLString(java.lang.String sqlString)
          PUBLIC: Set the receiver's insert SQL string.
 void setRelationTable(org.eclipse.persistence.internal.helper.DatabaseTable relationTable)
          PUBLIC: Set the relational table.
 void setRelationTableLockingClause(ObjectLevelReadQuery targetQuery, ObjectBuildingQuery sourceQuery)
          INTERNAL: Return relation table locking clause.
 void setRelationTableName(java.lang.String tableName)
          PUBLIC: Set the name of the relational table.
 void setSessionName(java.lang.String name)
          PUBLIC: Set the name of the session to execute the mapping's queries under.
 void setSourceKeyFieldNames(java.util.Vector fieldNames)
          PUBLIC: Set the source key field names associated with the mapping.
 void setSourceKeyFields(java.util.Vector<org.eclipse.persistence.internal.helper.DatabaseField> sourceKeyFields)
          INTERNAL: Set the source fields.
 void setSourceRelationKeyFieldName(java.lang.String sourceRelationKeyFieldName)
          PUBLIC: Set the source key field in the relation table.
 void setSourceRelationKeyFieldNames(java.util.Vector fieldNames)
          PUBLIC: Set the source relation key field names associated with the mapping.
 void setSourceRelationKeyFields(java.util.Vector<org.eclipse.persistence.internal.helper.DatabaseField> sourceRelationKeyFields)
          INTERNAL: Set the source fields.
 void setTargetKeyFieldNames(java.util.Vector fieldNames)
          INTERNAL: Set the target key field names associated with the mapping.
 void setTargetKeyFields(java.util.Vector<org.eclipse.persistence.internal.helper.DatabaseField> targetKeyFields)
          INTERNAL: Set the target fields.
 void setTargetRelationKeyFieldName(java.lang.String targetRelationKeyFieldName)
          PUBLIC: Set the target key field in the relation table.
 void setTargetRelationKeyFieldNames(java.util.Vector fieldNames)
          INTERNAL: Set the target relation key field names associated with the mapping.
 void setTargetRelationKeyFields(java.util.Vector<org.eclipse.persistence.internal.helper.DatabaseField> targetRelationKeyFields)
          INTERNAL: Set the target fields.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RelationTableMechanism

public RelationTableMechanism()
Method Detail

addSourceRelationKeyField

public void addSourceRelationKeyField(org.eclipse.persistence.internal.helper.DatabaseField sourceRelationKeyField,
                                      org.eclipse.persistence.internal.helper.DatabaseField sourcePrimaryKeyField)
PUBLIC: Add the fields in the intermediate table that corresponds to the primary key in the source table. This method is used if the keys are composite.


addSourceRelationKeyFieldName

public void addSourceRelationKeyFieldName(java.lang.String sourceRelationKeyFieldName,
                                          java.lang.String sourcePrimaryKeyFieldName)
PUBLIC: Add the fields in the intermediate table that corresponds to the primary key in the source table. This method is used if the keys are composite.


addTargetRelationKeyField

public void addTargetRelationKeyField(org.eclipse.persistence.internal.helper.DatabaseField targetRelationKeyField,
                                      org.eclipse.persistence.internal.helper.DatabaseField targetPrimaryKeyField)
PUBLIC: Add the fields in the intermediate table that corresponds to the primary key in the target table. This method is used if the keys are composite.


addTargetRelationKeyFieldName

public void addTargetRelationKeyFieldName(java.lang.String targetRelationKeyFieldName,
                                          java.lang.String targetPrimaryKeyFieldName)
PUBLIC: Add the fields in the intermediate table that corresponds to the primary key in the target table. This method is used if the keys are composite.


clone

public java.lang.Object clone()
INTERNAL: The mapping clones itself to create deep copy.

Overrides:
clone in class java.lang.Object

setRelationTableLockingClause

public void setRelationTableLockingClause(ObjectLevelReadQuery targetQuery,
                                          ObjectBuildingQuery sourceQuery)
INTERNAL: Return relation table locking clause.


getRelationTable

public org.eclipse.persistence.internal.helper.DatabaseTable getRelationTable()
INTERNAL: Return the relation table associated with the mapping.


getRelationTableName

public java.lang.String getRelationTableName()
PUBLIC: Return the relation table name associated with the mapping.


getRelationTableQualifiedName

public java.lang.String getRelationTableQualifiedName()
PUBLIC: Return the relation table qualified name associated with the mapping.


getSourceKeyFieldNames

public java.util.Vector getSourceKeyFieldNames()
PUBLIC: Return the source key field names associated with the mapping. These are in-order with the sourceRelationKeyFieldNames.


getSourceKeyFields

public java.util.Vector<org.eclipse.persistence.internal.helper.DatabaseField> getSourceKeyFields()
INTERNAL: Return all the source key fields associated with the mapping.


getSourceRelationKeyFieldNames

public java.util.Vector getSourceRelationKeyFieldNames()
PUBLIC: Return the source relation key field names associated with the mapping. These are in-order with the sourceKeyFieldNames.


getSourceRelationKeyFields

public java.util.Vector<org.eclipse.persistence.internal.helper.DatabaseField> getSourceRelationKeyFields()
INTERNAL: Return all the source relation key fields associated with the mapping.


getTargetKeyFieldNames

public java.util.Vector getTargetKeyFieldNames()
PUBLIC: Return the target key field names associated with the mapping. These are in-order with the targetRelationKeyFieldNames.


getTargetKeyFields

public java.util.Vector<org.eclipse.persistence.internal.helper.DatabaseField> getTargetKeyFields()
INTERNAL: Return all the target keys associated with the mapping.


getTargetRelationKeyFieldNames

public java.util.Vector getTargetRelationKeyFieldNames()
PUBLIC: Return the target relation key field names associated with the mapping. These are in-order with the targetKeyFieldNames.


getTargetRelationKeyFields

public java.util.Vector<org.eclipse.persistence.internal.helper.DatabaseField> getTargetRelationKeyFields()
INTERNAL: Return all the target relation key fields associated with the mapping.


hasRelationTable

public boolean hasRelationTable()
INTERNAL: Indicates whether the mechanism has relation table.


initialize

public void initialize(org.eclipse.persistence.internal.sessions.AbstractSession session,
                       ForeignReferenceMapping mapping)
                throws DescriptorException
INTERNAL: Initialize

Throws:
DescriptorException

joinRelationTableField

public Expression joinRelationTableField(Expression expression,
                                         Expression baseExpression)
INTERNAL: Adds to the passed expression a single relation table field joined to source field. Used to extend pessimistic locking clause in source query.


setCustomDeleteQuery

public void setCustomDeleteQuery(DataModifyQuery query)
PUBLIC: The default delete query for mapping can be overridden by specifying the new query. This query must delete the row from the M-M join table.


setCustomInsertQuery

public void setCustomInsertQuery(DataModifyQuery query)
PUBLIC: The default insert query for mapping can be overridden by specifying the new query. This query must insert the row into the M-M join table.


setDeleteSQLString

public void setDeleteSQLString(java.lang.String sqlString)
PUBLIC: Set the receiver's delete SQL string. This allows the user to override the SQL generated by TOPLink, with there own SQL or procedure call. The arguments are translated from the fields of the source row, through replacing the field names marked by '#' with the values for those fields. This is used to delete a single entry from the M-M join table. Example, 'delete from PROJ_EMP where PROJ_ID = #PROJ_ID AND EMP_ID = #EMP_ID'.


setDeleteCall

public void setDeleteCall(Call call)
PUBLIC: Set the receiver's delete Call. This allows the user to override the SQL generated by TOPLink, with there own SQL or procedure call. The arguments are translated from the fields of the source row. This is used to delete a single entry from the M-M join table. Example, 'new SQLCall("delete from PROJ_EMP where PROJ_ID = #PROJ_ID AND EMP_ID = #EMP_ID")'.


setInsertSQLString

public void setInsertSQLString(java.lang.String sqlString)
PUBLIC: Set the receiver's insert SQL string. This allows the user to override the SQL generated by TOPLink, with there own SQL or procedure call. The arguments are translated from the fields of the source row, through replacing the field names marked by '#' with the values for those fields. This is used to insert an entry into the M-M join table. Example, 'insert into PROJ_EMP (EMP_ID, PROJ_ID) values (#EMP_ID, #PROJ_ID)'.


setInsertCall

public void setInsertCall(Call call)
PUBLIC: Set the receiver's insert Call. This allows the user to override the SQL generated by TOPLink, with there own SQL or procedure call. The arguments are translated from the fields of the source row. This is used to insert an entry into the M-M join table. Example, 'new SQLCall("insert into PROJ_EMP (EMP_ID, PROJ_ID) values (#EMP_ID, #PROJ_ID)")'.


setRelationTable

public void setRelationTable(org.eclipse.persistence.internal.helper.DatabaseTable relationTable)
PUBLIC: Set the relational table. This is the join table that store both the source and target primary keys.


setRelationTableName

public void setRelationTableName(java.lang.String tableName)
PUBLIC: Set the name of the relational table. This is the join table that store both the source and target primary keys.


setSessionName

public void setSessionName(java.lang.String name)
PUBLIC: Set the name of the session to execute the mapping's queries under. This can be used by the session broker to override the default session to be used for the target class.


setSourceKeyFieldNames

public void setSourceKeyFieldNames(java.util.Vector fieldNames)
PUBLIC: Set the source key field names associated with the mapping. These must be in-order with the sourceRelationKeyFieldNames.


setSourceKeyFields

public void setSourceKeyFields(java.util.Vector<org.eclipse.persistence.internal.helper.DatabaseField> sourceKeyFields)
INTERNAL: Set the source fields.


setSourceRelationKeyFieldName

public void setSourceRelationKeyFieldName(java.lang.String sourceRelationKeyFieldName)
PUBLIC: Set the source key field in the relation table. This is the name of the foreign key in the relation table to the source's primary key field. This method is used if the source primary key is a singleton only.


setSourceRelationKeyFieldNames

public void setSourceRelationKeyFieldNames(java.util.Vector fieldNames)
PUBLIC: Set the source relation key field names associated with the mapping. These must be in-order with the sourceKeyFieldNames.


setSourceRelationKeyFields

public void setSourceRelationKeyFields(java.util.Vector<org.eclipse.persistence.internal.helper.DatabaseField> sourceRelationKeyFields)
INTERNAL: Set the source fields.


setTargetKeyFieldNames

public void setTargetKeyFieldNames(java.util.Vector fieldNames)
INTERNAL: Set the target key field names associated with the mapping. These must be in-order with the targetRelationKeyFieldNames.


setTargetKeyFields

public void setTargetKeyFields(java.util.Vector<org.eclipse.persistence.internal.helper.DatabaseField> targetKeyFields)
INTERNAL: Set the target fields.


setTargetRelationKeyFieldName

public void setTargetRelationKeyFieldName(java.lang.String targetRelationKeyFieldName)
PUBLIC: Set the target key field in the relation table. This is the name of the foreign key in the relation table to the target's primary key field. This method is used if the target's primary key is a singleton only.


setTargetRelationKeyFieldNames

public void setTargetRelationKeyFieldNames(java.util.Vector fieldNames)
INTERNAL: Set the target relation key field names associated with the mapping. These must be in-order with the targetKeyFieldNames.


setTargetRelationKeyFields

public void setTargetRelationKeyFields(java.util.Vector<org.eclipse.persistence.internal.helper.DatabaseField> targetRelationKeyFields)
INTERNAL: Set the target fields.


buildRelationTableSourceRow

public org.eclipse.persistence.internal.sessions.AbstractRecord buildRelationTableSourceRow(java.lang.Object sourceObject,
                                                                                            org.eclipse.persistence.internal.sessions.AbstractSession session,
                                                                                            ForeignReferenceMapping mapping)
INTERNAL: Create a row that contains source relation fields with values extracted from the source object.


addRelationTableSourceRow

public org.eclipse.persistence.internal.sessions.AbstractRecord addRelationTableSourceRow(java.lang.Object sourceObject,
                                                                                          org.eclipse.persistence.internal.sessions.AbstractSession session,
                                                                                          org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow,
                                                                                          ForeignReferenceMapping mapping)
INTERNAL: Add to a row source relation fields with values extracted from the source object.


buildRelationTableSourceRow

public org.eclipse.persistence.internal.sessions.AbstractRecord buildRelationTableSourceRow(org.eclipse.persistence.internal.sessions.AbstractRecord sourceRow)
INTERNAL: Create a row that contains source relation fields with values extracted from the source row.


addRelationTableSourceRow

public org.eclipse.persistence.internal.sessions.AbstractRecord addRelationTableSourceRow(org.eclipse.persistence.internal.sessions.AbstractRecord sourceRow,
                                                                                          org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow)
INTERNAL: Add to a row source relation fields with values extracted from the source row.


addRelationTableTargetRow

public org.eclipse.persistence.internal.sessions.AbstractRecord addRelationTableTargetRow(java.lang.Object targetObject,
                                                                                          org.eclipse.persistence.internal.sessions.AbstractSession session,
                                                                                          org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow,
                                                                                          ForeignReferenceMapping mapping)
INTERNAL: Add to a row target relation fields with values extracted from the target object.


buildRelationTableSourceAndTargetRow

public org.eclipse.persistence.internal.sessions.AbstractRecord buildRelationTableSourceAndTargetRow(java.lang.Object sourceObject,
                                                                                                     java.lang.Object targetObject,
                                                                                                     org.eclipse.persistence.internal.sessions.AbstractSession session,
                                                                                                     ForeignReferenceMapping mapping)
INTERNAL: Create a row that contains source relation fields with values extracted from the source object and target relation fields with values extracted from the target object.


buildRelationTableSourceAndTargetRow

public org.eclipse.persistence.internal.sessions.AbstractRecord buildRelationTableSourceAndTargetRow(org.eclipse.persistence.internal.sessions.AbstractRecord sourceRow,
                                                                                                     java.lang.Object targetObject,
                                                                                                     org.eclipse.persistence.internal.sessions.AbstractSession session,
                                                                                                     ForeignReferenceMapping mapping)
INTERNAL: Create a row that contains source relation fields with values extracted from the source row and target relation fields with values extracted from the target object.