EclipseLink 1.1.4, build 'v20100812-r7860' API Reference

org.eclipse.persistence.mappings
Class ManyToManyMapping

java.lang.Object
  extended by org.eclipse.persistence.mappings.DatabaseMapping
      extended by org.eclipse.persistence.mappings.ForeignReferenceMapping
          extended by org.eclipse.persistence.mappings.CollectionMapping
              extended by org.eclipse.persistence.mappings.ManyToManyMapping
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, ContainerMapping, MapComponentMapping, RelationalMapping

public class ManyToManyMapping
extends CollectionMapping
implements RelationalMapping, MapComponentMapping

Purpose: Many to many mappings are used to represent the relationships between a collection of source objects and a collection of target objects. The mapping require the creation of an intermediate table for managing the associations between the source and target records.

See Also:
Serialized Form
Author:
Sati
Since:
TOPLink/Java 1.0

Field Summary
protected  DataModifyQuery deleteQuery
          Query used for single row deletion.
protected  boolean hasCustomDeleteQuery
           
protected  boolean hasCustomInsertQuery
           
protected  HistoryPolicy historyPolicy
           
protected  DataModifyQuery insertQuery
          Used for insertion.
protected static java.lang.String ObjectAdded
           
protected static java.lang.String ObjectRemoved
           
protected static java.lang.String PostInsert
          Used for data modification events.
protected  org.eclipse.persistence.internal.helper.DatabaseTable relationTable
          The intermediate relation table.
protected  java.util.Vector<org.eclipse.persistence.internal.helper.DatabaseField> sourceKeyFields
          The field in the source table that corresponds to the key in the relation table
protected  java.util.Vector<org.eclipse.persistence.internal.helper.DatabaseField> sourceRelationKeyFields
          The field in the intermediate table that corresponds to the key in the source table
protected  java.util.Vector<org.eclipse.persistence.internal.helper.DatabaseField> targetKeyFields
          The field in the target table that corresponds to the key in the relation table
protected  java.util.Vector<org.eclipse.persistence.internal.helper.DatabaseField> targetRelationKeyFields
          The field in the intermediate table that corresponds to the key in the target table
 
Fields inherited from class org.eclipse.persistence.mappings.CollectionMapping
containerPolicy, deleteAllQuery, hasCustomDeleteAllQuery, hasOrderBy
 
Fields inherited from class org.eclipse.persistence.mappings.ForeignReferenceMapping
cascadeMerge, cascadePersist, cascadeRefresh, cascadeRemove, forceInitializationOfSelectionCriteria, hasCustomSelectionQuery, indirectionPolicy, INNER_JOIN, isPrivateOwned, joinFetch, NONE, OUTER_JOIN, referenceClass, referenceClassName, referenceDescriptor, relationshipPartner, relationshipPartnerAttributeName, requiresTransientWeavedFields, selectionQuery, tempInitSession, usesBatchReading
 
Fields inherited from class org.eclipse.persistence.mappings.DatabaseMapping
attributeAccessor, attributeName, descriptor, fields, isLazy, isOptional, isPrimaryKeyMapping, isReadOnly, isRemotelyInitialized, NO_FIELDS, NO_WEIGHT, properties, weight, WEIGHT_1
 
Constructor Summary
ManyToManyMapping()
          PUBLIC: Default constructor.
 
Method Summary
 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.
 java.lang.Object clone()
          INTERNAL: The mapping clones itself to create deep copy.
protected  java.util.Vector extractKeyFromRelationRow(org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Extract the source primary key value from the relation row.
protected  java.util.Vector extractPrimaryKeyFromRow(org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Extract the primary key value from the source row.
 java.lang.Object extractResultFromBatchQuery(DatabaseQuery query, org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow, org.eclipse.persistence.internal.sessions.AbstractSession session, org.eclipse.persistence.internal.sessions.AbstractRecord argumentRow)
          INTERNAL: Extract the value from the batch optimized query.
protected  DataModifyQuery getDeleteQuery()
           
 HistoryPolicy getHistoryPolicy()
          PUBLIC:
protected  DataModifyQuery getInsertQuery()
           
 Expression getJoinCriteria(org.eclipse.persistence.internal.expressions.QueryKeyExpression exp)
          INTERNAL: Returns the join criteria stored in the mapping selection query.
 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.
 Expression getSelectionCriteria()
          INTERNAL: Returns the selection criteria stored in the mapping selection query.
 ReadQuery getSelectionQuery()
          INTERNAL: Returns the read query assoicated 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 realtion 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.
protected  boolean hasCustomDeleteQuery()
           
protected  boolean hasCustomInsertQuery()
           
 boolean hasDependency()
          INTERNAL: The join table is a dependency if not read-only.
 void initialize(org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Initialize mappings
protected  void initializeDeleteAllQuery(org.eclipse.persistence.internal.sessions.AbstractSession session)
          Initialize delete all query.
protected  void initializeDeleteQuery(org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Initialize delete query.
protected  void initializeInsertQuery(org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Initialize insert query.
protected  void initializeRelationTable(org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Set the table qualifier on the relation table if required
protected  void initializeSelectionCriteria(org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Selection criteria is created to read target records from the table.
protected  void initializeSelectionCriteria(org.eclipse.persistence.internal.sessions.AbstractSession session, Expression startCriteria)
          INTERNAL: Selection criteria is created to read target records from the table.
protected  void initializeSourceKeys(org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: All the source key field names are converted to DatabaseField and stored.
protected  void initializeSourceKeysWithDefaults(org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: If a user does not specify the source key then the primary keys of the source table are used.
protected  void initializeSourceRelationKeys(org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: All the source relation key field names are converted to DatabaseField and stored.
protected  void initializeTargetKeys(org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: All the target key field names are converted to DatabaseField and stored.
protected  void initializeTargetKeysWithDefaults(org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: If a user does not specify the target key then the primary keys of the target table are used.
protected  void initializeTargetRelationKeys(org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: All the target relation key field names are converted to DatabaseField and stored.
protected  void insertAddedObjectEntry(ObjectLevelModifyQuery query, java.lang.Object objectAdded)
          INTERNAL: An object was added to the collection during an update, insert it.
 void insertIntoRelationTable(WriteObjectQuery query)
          INTERNAL: Insert into relation table.
 void insertTargetObjects(WriteObjectQuery query)
          INTERNAL: Write the target objects if the cascade policy requires them to be written first.
 boolean isJoiningSupported()
          INTERNAL: Return if this mapping support joining.
 boolean isManyToManyMapping()
          INTERNAL:
 boolean isRelationalMapping()
          INTERNAL:
protected  boolean isSingleSourceRelationKeySpecified()
          INTERNAL: Checks if a single source key was specified.
protected  boolean isSingleTargetRelationKeySpecified()
          INTERNAL: Checks if a single target key was specified.
protected  void objectAddedDuringUpdate(ObjectLevelModifyQuery query, java.lang.Object objectAdded, org.eclipse.persistence.internal.sessions.ObjectChangeSet changeSet)
          INTERNAL: An object was added to the collection during an update, insert it if private.
protected  void objectRemovedDuringUpdate(ObjectLevelModifyQuery query, java.lang.Object objectDeleted)
          INTERNAL: An object was removed to the collection during an update, delete it if private.
 void performDataModificationEvent(java.lang.Object[] event, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Perform the commit event.
 void postInsert(WriteObjectQuery query)
          INTERNAL: Insert into relation table.
protected  void postPrepareNestedBatchQuery(ReadQuery batchQuery, ReadAllQuery query)
          INTERNAL: Add additional fields and check for history.
 void postUpdate(WriteObjectQuery query)
          INTERNAL: Update the relation table with the entries related to this mapping.
 void preDelete(DeleteObjectQuery query)
          INTERNAL: Delete entries related to this mapping from the relation table.
protected  ReadQuery prepareHistoricalQuery(ReadQuery targetQuery, ObjectBuildingQuery sourceQuery, org.eclipse.persistence.internal.sessions.AbstractSession executionSession)
          INTERNAL: Append the temporal selection to the query selection criteria.
protected  void prepareTranslationRow(org.eclipse.persistence.internal.sessions.AbstractRecord translationRow, java.lang.Object object, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: The translation row may require additional fields than the primary key if the mapping in not on the primary key.
 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.
protected  void setDeleteQuery(DataModifyQuery deleteQuery)
           
 void setDeleteSQLString(java.lang.String sqlString)
          PUBLIC: Set the receiver's delete SQL string.
protected  void setHasCustomDeleteQuery(boolean hasCustomDeleteQuery)
           
protected  void setHasCustomInsertQuery(boolean bool)
           
 void setHistoryPolicy(HistoryPolicy policy)
          PUBLIC:
 void setInsertCall(Call call)
          PUBLIC: Set the receiver's insert Call.
protected  void setInsertQuery(DataModifyQuery insertQuery)
           
 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 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 org.eclipse.persistence.mappings.CollectionMapping
addAggregateOrderBy, addAscendingOrdering, addDescendingOrdering, addOrderBy, addToCollectionChangeRecord, buildBackupCloneForPartObject, buildChangeRecord, buildCloneForPartObject, buildCopy, buildElementClone, buildReferencesPKList, calculateDeferredChanges, cascadeDiscoverAndPersistUnregisteredNewObjects, cascadeMerge, cascadePerformRemoveIfRequired, cascadePerformRemovePrivateOwnedObjectFromChangeSetIfRequired, cascadeRegisterNewIfRequired, compareCollectionsForChange, compareForChange, compareObjects, compareObjectsAndWrite, compareObjectsWithoutPrivateOwned, compareObjectsWithPrivateOwned, convertClassNamesToClasses, fixRealObjectReferences, getContainerPolicy, getDeleteAllQuery, getObjectCorrespondingTo, getOrderByQueryKeyExpressions, getRealCollectionAttributeValueFromObject, hasCustomDeleteAllQuery, hasOrderBy, isAttributeValueInstantiatedOrChanged, isChangeTrackingSupported, isCollectionMapping, iterateOnElement, iterateOnRealAttributeValue, mergeChangesIntoObject, mergeIntoObject, mustDeleteReferenceObjectsOneByOne, objectUnchangedDuringUpdate, objectUnchangedDuringUpdate, readPrivateOwnedForObject, removeFromCollectionChangeRecord, replaceValueHoldersIn, setChangeListener, setContainerPolicy, setCustomDeleteAllQuery, setDeleteAllCall, setDeleteAllQuery, setDeleteAllSQLString, setHasCustomDeleteAllQuery, setSelectionQueryContainerPolicy, simpleAddToCollectionChangeRecord, simpleRemoveFromCollectionChangeRecord, updateChangeRecord, updateCollectionChangeRecord, useCollectionClass, useCollectionClassName, useListClassName, useMapClass, useMapClass, useMapClassName, useSortedSetClass, useSortedSetClassName, useSortedSetClassName, useTransparentCollection, useTransparentList, useTransparentMap, useTransparentSet, validateBeforeInitialization, valueFromPKList, valueFromRowInternalWithJoin, verifyDelete
 
Methods inherited from class org.eclipse.persistence.mappings.ForeignReferenceMapping
batchedValueFromRow, buildBackupClone, buildClone, buildCloneFromRow, createUnitOfWorkValueHolder, dontDoMerge, dontUseBatchReading, dontUseIndirection, fixObjectReferences, getAttributeValueFromObject, getAttributeValueWithClonedValueHolders, getBatchReadObjects, getIndirectionPolicy, getJoinFetch, getRealAttributeValueFromAttribute, getReferenceClass, getReferenceClassName, getReferenceDescriptor, getRelationshipPartner, getRelationshipPartnerAttributeName, getTempSession, getValueFromRemoteValueHolder, hasCustomSelectionQuery, initializeReferenceDescriptor, initializeSelectionQuery, instantiateAttribute, isAttributeValueInstantiated, isCascadeMerge, isCascadePersist, isCascadeRefresh, isCascadeRemove, isForeignReferenceMapping, isInnerJoinFetched, isJoinFetched, isLazy, isOuterJoinFetched, isPrivateOwned, iterate, mergeRemoteValueHolder, preInitialize, prepareNestedBatchQuery, prepareNestedJoinQueryClone, prepareNestedJoins, privateOwnedRelationship, remoteInitialization, requiresTransientWeavedFields, setBatchReadObjects, setCascadeAll, setCascadeMerge, setCascadePersist, setCascadeRefresh, setCascadeRemove, setCustomSelectionQuery, setForceInitializationOfSelectionCriteria, setHasCustomSelectionQuery, setIndirectionPolicy, setIsPrivateOwned, setJoinFetch, setRealAttributeValueInObject, setReferenceClass, setReferenceClassName, setReferenceDescriptor, setRelationshipPartner, setRelationshipPartnerAttributeName, setRequiresTransientWeavedFields, setSelectionCall, setSelectionCriteria, setSelectionQuery, setSelectionSQLString, setTempSession, setUsesBatchReading, setUsesIndirection, shouldForceInitializationOfSelectionCriteria, shouldInitializeSelectionCriteria, shouldMergeCascadeParts, shouldMergeCascadeReference, shouldObjectModifyCascadeToParts, shouldUseBatchReading, shouldUseValueFromRowWithJoin, trimRowForJoin, trimRowForJoin, useBasicIndirection, useBatchReading, useContainerIndirection, useInnerJoinFetch, useOuterJoinFetch, usesIndirection, useWeavedIndirection, valueFromRow, valueFromRowInternal
 
Methods inherited from class org.eclipse.persistence.mappings.DatabaseMapping
buildExpression, buildObjectJoinExpression, buildObjectJoinExpression, buildShallowOriginalFromRow, cloneFields, collectFields, extractNestedExpressions, getAttributeAccessor, getAttributeClassification, getAttributeName, getDescriptor, getField, getFieldClassification, getFields, getGetMethodName, getProperties, getProperty, getRealAttributeValueFromObject, getSelectFields, getSelectTables, getSetMethodName, getWeight, hasConstraintDependency, hasInverseConstraintDependency, hasRootExpressionThatShouldUseOuterJoin, isAbstractCompositeCollectionMapping, isAbstractCompositeDirectCollectionMapping, isAbstractCompositeObjectMapping, isAbstractDirectMapping, isAggregateCollectionMapping, isAggregateMapping, isAggregateObjectMapping, isCandidateForPrivateOwnedRemoval, isCascadedLockingSupported, isCloningRequired, isDatabaseMapping, isDirectCollectionMapping, isDirectMapMapping, isDirectToFieldMapping, isDirectToXMLTypeMapping, isEISMapping, isNestedTableMapping, isObjectReferenceMapping, isOneToManyMapping, isOneToOneMapping, isOptional, isPrimaryKeyMapping, isReadOnly, isReferenceMapping, isRemotelyInitialized, isStructureMapping, isTransformationMapping, isUnidirectionalOneToManyMapping, isUsingMethodAccess, isVariableOneToOneMapping, isWriteOnly, isXMLMapping, postCalculateChanges, postCalculateChangesOnDeleted, postDelete, postInitialize, preInsert, prepareCascadeLockingPolicy, preUpdate, readFromResultSetIntoObject, readFromRowIntoObject, readOnly, readWrite, rehashFieldDependancies, remotelyInitialized, setAttributeAccessor, setAttributeName, setAttributeValueInObject, setDescriptor, setFields, setGetMethodName, setIsLazy, setIsOptional, setIsPrimaryKeyMapping, setIsReadOnly, setProperties, setProperty, setSetMethodName, setWeight, toString, validateAfterInitialization, valueFromObject, valueFromResultSet, valueFromRow, writeFromAttributeIntoRow, writeFromObjectIntoRow, writeFromObjectIntoRowForShallowInsert, writeFromObjectIntoRowForShallowInsertWithChangeRecord, writeFromObjectIntoRowForUpdate, writeFromObjectIntoRowForWhereClause, writeFromObjectIntoRowWithChangeRecord, writeInsertFieldsIntoRow, writeUpdateFieldsIntoRow
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PostInsert

protected static final java.lang.String PostInsert
Used for data modification events.

See Also:
Constant Field Values

ObjectRemoved

protected static final java.lang.String ObjectRemoved
See Also:
Constant Field Values

ObjectAdded

protected static final java.lang.String ObjectAdded
See Also:
Constant Field Values

relationTable

protected transient org.eclipse.persistence.internal.helper.DatabaseTable relationTable
The intermediate relation table.


sourceKeyFields

protected transient java.util.Vector<org.eclipse.persistence.internal.helper.DatabaseField> sourceKeyFields
The field in the source table that corresponds to the key in the relation table


targetKeyFields

protected transient java.util.Vector<org.eclipse.persistence.internal.helper.DatabaseField> targetKeyFields
The field in the target table that corresponds to the key in the relation table


sourceRelationKeyFields

protected transient java.util.Vector<org.eclipse.persistence.internal.helper.DatabaseField> sourceRelationKeyFields
The field in the intermediate table that corresponds to the key in the source table


targetRelationKeyFields

protected transient java.util.Vector<org.eclipse.persistence.internal.helper.DatabaseField> targetRelationKeyFields
The field in the intermediate table that corresponds to the key in the target table


deleteQuery

protected transient DataModifyQuery deleteQuery
Query used for single row deletion.


hasCustomDeleteQuery

protected transient boolean hasCustomDeleteQuery

insertQuery

protected transient DataModifyQuery insertQuery
Used for insertion.


hasCustomInsertQuery

protected transient boolean hasCustomInsertQuery

historyPolicy

protected HistoryPolicy historyPolicy
Constructor Detail

ManyToManyMapping

public ManyToManyMapping()
PUBLIC: Default constructor.

Method Detail

isRelationalMapping

public boolean isRelationalMapping()
INTERNAL:

Overrides:
isRelationalMapping in class DatabaseMapping

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 CollectionMapping

extractKeyFromRelationRow

protected java.util.Vector extractKeyFromRelationRow(org.eclipse.persistence.internal.sessions.AbstractRecord row,
                                                     org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Extract the source primary key value from the relation row. Used for batch reading, most following same order and fields as in the mapping.


extractPrimaryKeyFromRow

protected java.util.Vector extractPrimaryKeyFromRow(org.eclipse.persistence.internal.sessions.AbstractRecord row,
                                                    org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Extract the primary key value from the source row. Used for batch reading, most following same order and fields as in the mapping.


postPrepareNestedBatchQuery

protected void postPrepareNestedBatchQuery(ReadQuery batchQuery,
                                           ReadAllQuery query)
INTERNAL: Add additional fields and check for history.

Overrides:
postPrepareNestedBatchQuery in class ForeignReferenceMapping

extractResultFromBatchQuery

public java.lang.Object extractResultFromBatchQuery(DatabaseQuery query,
                                                    org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow,
                                                    org.eclipse.persistence.internal.sessions.AbstractSession session,
                                                    org.eclipse.persistence.internal.sessions.AbstractRecord argumentRow)
INTERNAL: Extract the value from the batch optimized query.

Overrides:
extractResultFromBatchQuery in class ForeignReferenceMapping

getDeleteQuery

protected DataModifyQuery getDeleteQuery()

getInsertQuery

protected DataModifyQuery getInsertQuery()

getJoinCriteria

public Expression getJoinCriteria(org.eclipse.persistence.internal.expressions.QueryKeyExpression exp)
INTERNAL: Returns the join criteria stored in the mapping selection query. This criteria is used to read reference objects across the tables from the database.

Overrides:
getJoinCriteria in class ForeignReferenceMapping

getHistoryPolicy

public HistoryPolicy getHistoryPolicy()
PUBLIC:


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.


getSelectionCriteria

public Expression getSelectionCriteria()
INTERNAL: Returns the selection criteria stored in the mapping selection query. This criteria is used to read reference objects from the database.

Overrides:
getSelectionCriteria in class ForeignReferenceMapping
See Also:
OneToOneMapping.buildSelectionCriteria(), OneToManyMapping.buildSelectionCriteria()

getSelectionQuery

public ReadQuery getSelectionQuery()
INTERNAL: Returns the read query assoicated with the mapping.

Overrides:
getSelectionQuery in class ForeignReferenceMapping

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 realtion 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.


hasCustomDeleteQuery

protected boolean hasCustomDeleteQuery()

hasCustomInsertQuery

protected boolean hasCustomInsertQuery()

hasDependency

public boolean hasDependency()
INTERNAL: The join table is a dependency if not read-only.

Overrides:
hasDependency in class DatabaseMapping

initialize

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

Overrides:
initialize in class CollectionMapping
Throws:
DescriptorException

initializeDeleteAllQuery

protected void initializeDeleteAllQuery(org.eclipse.persistence.internal.sessions.AbstractSession session)
Initialize delete all query. This query is used to all relevant rows from the relation table.


initializeDeleteQuery

protected void initializeDeleteQuery(org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Initialize delete query. This query is used to delete a specific row from the join table in uow, given the objects on both sides of the relation.


initializeInsertQuery

protected void initializeInsertQuery(org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Initialize insert query. This query is used to insert the collection of objects into the relation table.


initializeRelationTable

protected void initializeRelationTable(org.eclipse.persistence.internal.sessions.AbstractSession session)
                                throws DescriptorException
INTERNAL: Set the table qualifier on the relation table if required

Throws:
DescriptorException

initializeSelectionCriteria

protected void initializeSelectionCriteria(org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Selection criteria is created to read target records from the table.


initializeSelectionCriteria

protected void initializeSelectionCriteria(org.eclipse.persistence.internal.sessions.AbstractSession session,
                                           Expression startCriteria)
INTERNAL: Selection criteria is created to read target records from the table.


initializeSourceKeys

protected void initializeSourceKeys(org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: All the source key field names are converted to DatabaseField and stored.


initializeSourceKeysWithDefaults

protected void initializeSourceKeysWithDefaults(org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: If a user does not specify the source key then the primary keys of the source table are used.


initializeSourceRelationKeys

protected void initializeSourceRelationKeys(org.eclipse.persistence.internal.sessions.AbstractSession session)
                                     throws DescriptorException
INTERNAL: All the source relation key field names are converted to DatabaseField and stored.

Throws:
DescriptorException

initializeTargetKeys

protected void initializeTargetKeys(org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: All the target key field names are converted to DatabaseField and stored.


initializeTargetKeysWithDefaults

protected void initializeTargetKeysWithDefaults(org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: If a user does not specify the target key then the primary keys of the target table are used.


initializeTargetRelationKeys

protected void initializeTargetRelationKeys(org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: All the target relation key field names are converted to DatabaseField and stored.


insertAddedObjectEntry

protected void insertAddedObjectEntry(ObjectLevelModifyQuery query,
                                      java.lang.Object objectAdded)
                               throws DatabaseException,
                                      OptimisticLockException
INTERNAL: An object was added to the collection during an update, insert it.

Throws:
DatabaseException
OptimisticLockException

insertIntoRelationTable

public void insertIntoRelationTable(WriteObjectQuery query)
                             throws DatabaseException
INTERNAL: Insert into relation table. This follows following steps.

- Extract primary key and its value from the source object.

- Extract target key and its value from the target object.

- Construct a insert statement with above fields and values for relation table.

- execute the statement.

- Repeat above three statements until all the target objects are done.

Throws:
DatabaseException

insertTargetObjects

public void insertTargetObjects(WriteObjectQuery query)
                         throws DatabaseException,
                                OptimisticLockException
INTERNAL: Write the target objects if the cascade policy requires them to be written first. They must be written within a unit of work to ensure that they exist.

Throws:
DatabaseException
OptimisticLockException

isJoiningSupported

public boolean isJoiningSupported()
INTERNAL: Return if this mapping support joining.

Overrides:
isJoiningSupported in class ForeignReferenceMapping

isManyToManyMapping

public boolean isManyToManyMapping()
INTERNAL:

Overrides:
isManyToManyMapping in class DatabaseMapping

isSingleSourceRelationKeySpecified

protected boolean isSingleSourceRelationKeySpecified()
INTERNAL: Checks if a single source key was specified.


isSingleTargetRelationKeySpecified

protected boolean isSingleTargetRelationKeySpecified()
INTERNAL: Checks if a single target key was specified.


objectAddedDuringUpdate

protected void objectAddedDuringUpdate(ObjectLevelModifyQuery query,
                                       java.lang.Object objectAdded,
                                       org.eclipse.persistence.internal.sessions.ObjectChangeSet changeSet)
                                throws DatabaseException,
                                       OptimisticLockException
INTERNAL: An object was added to the collection during an update, insert it if private.

Overrides:
objectAddedDuringUpdate in class CollectionMapping
Throws:
DatabaseException
OptimisticLockException

objectRemovedDuringUpdate

protected void objectRemovedDuringUpdate(ObjectLevelModifyQuery query,
                                         java.lang.Object objectDeleted)
                                  throws DatabaseException,
                                         OptimisticLockException
INTERNAL: An object was removed to the collection during an update, delete it if private.

Overrides:
objectRemovedDuringUpdate in class CollectionMapping
Throws:
DatabaseException
OptimisticLockException

performDataModificationEvent

public void performDataModificationEvent(java.lang.Object[] event,
                                         org.eclipse.persistence.internal.sessions.AbstractSession session)
                                  throws DatabaseException,
                                         DescriptorException
INTERNAL: Perform the commit event. This is used in the uow to delay data modifications.

Overrides:
performDataModificationEvent in class DatabaseMapping
Throws:
DatabaseException
DescriptorException

postInsert

public void postInsert(WriteObjectQuery query)
                throws DatabaseException
INTERNAL: Insert into relation table. This follows following steps.

- Extract primary key and its value from the source object.

- Extract target key and its value from the target object.

- Construct a insert statement with above fields and values for relation table.

- execute the statement.

- Repeat above three statements until all the target objects are done.

Overrides:
postInsert in class DatabaseMapping
Throws:
DatabaseException

postUpdate

public void postUpdate(WriteObjectQuery query)
                throws DatabaseException
INTERNAL: Update the relation table with the entries related to this mapping. Delete entries removed, insert entries added. If private also insert/delete/update target objects.

Overrides:
postUpdate in class DatabaseMapping
Throws:
DatabaseException

preDelete

public void preDelete(DeleteObjectQuery query)
               throws DatabaseException
INTERNAL: Delete entries related to this mapping from the relation table.

Overrides:
preDelete in class DatabaseMapping
Throws:
DatabaseException

prepareTranslationRow

protected void prepareTranslationRow(org.eclipse.persistence.internal.sessions.AbstractRecord translationRow,
                                     java.lang.Object object,
                                     org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: The translation row may require additional fields than the primary key if the mapping in not on the primary key.

Overrides:
prepareTranslationRow in class CollectionMapping

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.


setDeleteQuery

protected void setDeleteQuery(DataModifyQuery deleteQuery)

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")'.


setHasCustomDeleteQuery

protected void setHasCustomDeleteQuery(boolean hasCustomDeleteQuery)

setHasCustomInsertQuery

protected void setHasCustomInsertQuery(boolean bool)

setInsertQuery

protected void setInsertQuery(DataModifyQuery insertQuery)

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.


setHistoryPolicy

public void setHistoryPolicy(HistoryPolicy policy)
PUBLIC:


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.

Overrides:
setSessionName in class CollectionMapping

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.


prepareHistoricalQuery

protected ReadQuery prepareHistoricalQuery(ReadQuery targetQuery,
                                           ObjectBuildingQuery sourceQuery,
                                           org.eclipse.persistence.internal.sessions.AbstractSession executionSession)
INTERNAL: Append the temporal selection to the query selection criteria.

Overrides:
prepareHistoricalQuery in class ForeignReferenceMapping

EclipseLink 1.1.4, build 'v20100812-r7860' API Reference