Oracle Fusion Middleware Java API Reference for Oracle TopLink
11g Release 1 (11.1.1)

B32476-03

oracle.toplink.mappings
Class ManyToManyMapping

java.lang.Object
  extended by oracle.toplink.mappings.DatabaseMapping
      extended by oracle.toplink.mappings.ForeignReferenceMapping
          extended by oracle.toplink.mappings.CollectionMapping
              extended by oracle.toplink.mappings.ManyToManyMapping
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, ContainerMapping, oracle.toplink.mappings.RelationalMapping

public class ManyToManyMapping
extends CollectionMapping
implements oracle.toplink.mappings.RelationalMapping

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.

Since:
TOPLink/Java 1.0
See Also:
Serialized Form

Field Summary
 
Fields inherited from class oracle.toplink.mappings.ForeignReferenceMapping
INNER_JOIN, NONE, OUTER_JOIN
 
Constructor Summary
ManyToManyMapping()
          Default constructor.
 
Method Summary
 void addSourceRelationKeyField(DatabaseField sourceRelationKeyField, DatabaseField sourcePrimaryKeyField)
          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)
          Add the fields in the intermediate table that corresponds to the primary key in the source table.
 void addTargetRelationKeyField(DatabaseField targetRelationKeyField, DatabaseField targetPrimaryKeyField)
          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)
          Add the fields in the intermediate table that corresponds to the primary key in the target table.
 HistoryPolicy getHistoryPolicy()
          
 java.lang.String getRelationTableName()
          Return the relation table name associated with the mapping.
 java.lang.String getRelationTableQualifiedName()
          Return the relation table qualified name associated with the mapping.
 java.util.Vector getSourceKeyFieldNames()
          Return the source key field names associated with the mapping.
 java.util.Vector getSourceRelationKeyFieldNames()
          Return the source relation key field names associated with the mapping.
 java.util.Vector getTargetKeyFieldNames()
          Return the target key field names associated with the mapping.
 java.util.Vector getTargetRelationKeyFieldNames()
          Return the target relation key field names associated with the mapping.
 void setCustomDeleteQuery(DataModifyQuery query)
          The default delete query for mapping can be overridden by specifying the new query.
 void setCustomInsertQuery(DataModifyQuery query)
          The default insert query for mapping can be overridden by specifying the new query.
 void setDeleteCall(Call call)
          Set the receiver's delete Call.
 void setDeleteSQLString(java.lang.String sqlString)
          Set the receiver's delete SQL string.
 void setHistoryPolicy(HistoryPolicy policy)
          
 void setInsertCall(Call call)
          Set the receiver's insert Call.
 void setInsertSQLString(java.lang.String sqlString)
          Set the receiver's insert SQL string.
 void setRelationTable(DatabaseTable relationTable)
          Set the relational table.
 void setRelationTableName(java.lang.String tableName)
          Set the name of the relational table.
 void setSessionName(java.lang.String name)
          Set the name of the session to execute the mapping's queries under.
 void setSourceKeyFieldNames(java.util.Vector fieldNames)
          Set the source key field names associated with the mapping.
 void setSourceRelationKeyFieldName(java.lang.String sourceRelationKeyFieldName)
          Set the source key field in the relation table.
 void setSourceRelationKeyFieldNames(java.util.Vector fieldNames)
          Set the source relation key field names associated with the mapping.
 void setTargetRelationKeyFieldName(java.lang.String targetRelationKeyFieldName)
          Set the target key field in the relation table.
 
Methods inherited from class oracle.toplink.mappings.CollectionMapping
addAggregateOrderBy, addAscendingOrdering, addDescendingOrdering, addOrderBy, getRealCollectionAttributeValueFromObject, setContainerPolicy, setCustomDeleteAllQuery, setDeleteAllCall, setDeleteAllSQLString, simpleAddToCollectionChangeRecord, simpleRemoveFromCollectionChangeRecord, useCollectionClass, useMapClass, useMapClass, useSortedSetClass, useTransparentCollection, useTransparentList, useTransparentMap, useTransparentSet
 
Methods inherited from class oracle.toplink.mappings.ForeignReferenceMapping
dontUseBatchReading, dontUseIndirection, getJoinFetch, getReferenceClass, getRelationshipPartnerAttributeName, isCascadeMerge, isCascadePersist, isCascadeRefresh, isCascadeRemove, isInnerJoinFetched, isJoinFetched, isOuterJoinFetched, isPrivateOwned, privateOwnedRelationship, setCascadeAll, setCascadeMerge, setCascadePersist, setCascadeRefresh, setCascadeRemove, setCustomSelectionQuery, setIndirectionPolicy, setIsPrivateOwned, setJoinFetch, setReferenceClass, setRelationshipPartnerAttributeName, setSelectionCall, setSelectionCriteria, setSelectionSQLString, setUsesBatchReading, setUsesIndirection, shouldUseBatchReading, useBasicIndirection, useBatchReading, useContainerIndirection, useInnerJoinFetch, useOuterJoinFetch, usesIndirection
 
Methods inherited from class oracle.toplink.mappings.DatabaseMapping
getAttributeAccessor, getAttributeClassification, getAttributeName, getGetMethodName, getProperty, getSetMethodName, isLazy, isOptional, isUsingMethodAccess, readOnly, readWrite, setAttributeAccessor, setAttributeName, setGetMethodName, setIsLazy, setIsOptional, setIsReadOnly, setProperty, setSetMethodName, setWeight
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ManyToManyMapping

public ManyToManyMapping()
Default constructor.

Method Detail

addSourceRelationKeyField

public void addSourceRelationKeyField(DatabaseField sourceRelationKeyField,
                                      DatabaseField sourcePrimaryKeyField)
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)
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(DatabaseField targetRelationKeyField,
                                      DatabaseField targetPrimaryKeyField)
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)
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.


getHistoryPolicy

public HistoryPolicy getHistoryPolicy()


getRelationTableName

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


getRelationTableQualifiedName

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


getSourceKeyFieldNames

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


getSourceRelationKeyFieldNames

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


getTargetKeyFieldNames

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


getTargetRelationKeyFieldNames

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


setCustomDeleteQuery

public void setCustomDeleteQuery(DataModifyQuery query)
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)
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)
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)
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)
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)
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(DatabaseTable relationTable)
Set the relational table. This is the join table that store both the source and target primary keys.


setHistoryPolicy

public void setHistoryPolicy(HistoryPolicy policy)


setRelationTableName

public void setRelationTableName(java.lang.String tableName)
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)
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)
Set the source key field names associated with the mapping. These must be in-order with the sourceRelationKeyFieldNames.


setSourceRelationKeyFieldName

public void setSourceRelationKeyFieldName(java.lang.String sourceRelationKeyFieldName)
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)
Set the source relation key field names associated with the mapping. These must be in-order with the sourceKeyFieldNames.


setTargetRelationKeyFieldName

public void setTargetRelationKeyFieldName(java.lang.String targetRelationKeyFieldName)
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.


Copyright © 1998, 2010, Oracle. All Rights Reserved.