Oracle Application Server TopLink API Reference
10g Release 2 (10.1.2)

B15903-01


oracle.toplink.mappings
Class ManyToManyMapping

java.lang.Object
  extended byoracle.toplink.mappings.DatabaseMapping
      extended byoracle.toplink.mappings.ForeignReferenceMapping
          extended byoracle.toplink.mappings.CollectionMapping
              extended byoracle.toplink.mappings.ManyToManyMapping

All Implemented Interfaces:
java.lang.Cloneable, ContainerMapping, java.io.Serializable

public class ManyToManyMapping
extends CollectionMapping

Purpose: Many to many mappings ae 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 manageing the associations between the source and target records.

Since:
TOPLink/Java 1.0
See Also:
Serialized Form

Constructor Summary
ManyToManyMapping()
PUBLIC: Default constructor.

Method Summary
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 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.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 getSourceRelationKeyFieldNames()
PUBLIC: Return the source relation key field names associated with the mapping.
java.util.Vector getTargetKeyFieldNames()
PUBLIC: Return the target key field names associated with the mapping.
java.util.Vector getTargetRelationKeyFieldNames()
PUBLIC: Return the target relation key field names associated with the mapping.
void setCustomDeleteQuery(DataModifyQuery query)
PUBLIC: The default insert 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 setDeleteSQLString(java.lang.String sqlString)
PUBLIC: Set the receiver's delete SQL string.
void setInsertSQLString(java.lang.String sqlString)
PUBLIC: Set the receiver's insert SQL string.
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 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 setTargetKeyFieldNames(java.util.Vector fieldNames)
PUBLIC: Set the target key field names associated with the mapping.
void setTargetRelationKeyFieldName(java.lang.String targetRelationKeyFieldName)
PUBLIC: Set the target key field in the relation table.
void setTargetRelationKeyFieldNames(java.util.Vector fieldNames)
PUBLIC: Set the target relation key field names associated with the mapping.

Methods inherited from class oracle.toplink.mappings.CollectionMapping
addAscendingOrdering, addDescendingOrdering, getRealCollectionAttributeValueFromObject, setContainerPolicy, setCustomDeleteAllQuery, setDeleteAllSQLString, simpleAddToCollectionChangeRecord, simpleRemoveFromCollectionChangeRecord, useCollectionClass, useMapClass, useSortedSetClass, useTransparentCollection, useTransparentMap

Methods inherited from class oracle.toplink.mappings.ForeignReferenceMapping
dontUseBatchReading, dontUseIndirection, getReferenceClass, getRelationshipPartnerAttributeName, privateOwnedRelationship, setCustomSelectionQuery, setIndirectionPolicy, setReferenceClass, setRelationshipPartnerAttributeName, setSelectionCriteria, setSelectionSQLString, setUsesBatchReading, setUsesIndirection, shouldUseBatchReading, useBasicIndirection, useBatchReading, useContainerIndirection, useIndirection, usesIndirection

Methods inherited from class oracle.toplink.mappings.DatabaseMapping
getAttributeClassification, getAttributeName, getGetMethodName, getSetMethodName, readOnly, readWrite, setAttributeName, setGetMethodName, setIsReadOnly, setSetMethodName, setWeight

Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait

Constructor Detail

ManyToManyMapping

public ManyToManyMapping()
PUBLIC: Default constructor.

Method Detail

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.

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.

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.

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.

getTargetKeyFieldNames

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

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.

setCustomDeleteQuery

public void setCustomDeleteQuery(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.

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

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

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.

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.

setTargetKeyFieldNames

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

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)
PUBLIC: Set the target relation key field names associated with the mapping. These must be in-order with the targetKeyFieldNames.

Copyright © 1998, 2005 Oracle Corporation. All Rights Reserved.