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

B15903-01


oracle.toplink.mappings
Class DirectCollectionMapping

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

All Implemented Interfaces:
java.lang.Cloneable, ContainerMapping, java.io.Serializable
Direct Known Subclasses:
DirectMapMapping

public class DirectCollectionMapping
extends CollectionMapping

Purpose: This mapping is used to store objects into a collection that are non TopLink enabled.

Since:
TOPLink/Java 1.0
See Also:
Serialized Form

Constructor Summary
DirectCollectionMapping()
PUBLIC: Default constructor.

Method Summary
void addReferenceKeyFieldName(java.lang.String referenceForeignKeyFieldName, java.lang.String sourcePrimaryKeyFieldName)
PUBLIC: Add the name of the reference key field.
java.lang.String getDirectFieldName()
PUBLIC: Returns the name of the field name in the reference table.
java.util.Vector getReferenceKeyFieldNames()
PUBLIC: Return the reference key field names associated with the mapping.
java.lang.String getReferenceTableName()
PUBLIC: Returns the name of the reference table
java.lang.String getReferenceTableQualifiedName()
PUBLIC: Returns the qualified name of the reference table
java.util.Vector getSourceKeyFieldNames()
PUBLIC: Return the source key field names associated with the mapping.
void setContainerPolicy(oracle.toplink.internal.queryframework.ContainerPolicy containerPolicy)
ADVANCED: Configure the mapping to use a container policy.
void setCustomInsertQuery(DataModifyQuery query)
PUBLIC: The default insert query for mapping can be overridden by specifying the new query.
void setDirectFieldName(java.lang.String fieldName)
PUBLIC: Set the direct field name in the reference table.
void setInsertSQLString(java.lang.String sqlString)
PUBLIC: Set the receiver's insert SQL string.
void setReferenceKeyFieldName(java.lang.String fieldName)
PUBLIC: Set the name of the reference key field.
void setReferenceKeyFieldNames(java.util.Vector fieldNames)
PUBLIC: Set the reference key field names associated with the mapping.
void setReferenceTableName(java.lang.String tableName)
PUBLIC: Set the reference table name.
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 simpleAddToCollectionChangeRecord(java.lang.Object referenceKey, java.lang.Object objectToAdd, oracle.toplink.internal.sessions.ObjectChangeSet changeSet, oracle.toplink.publicinterface.Session session)
ADVANCED: This method is used to have an object add to a collection once the changeSet is applied The referenceKey parameter should only be used for direct Maps.
void simpleRemoveFromCollectionChangeRecord(java.lang.Object referenceKey, java.lang.Object objectToRemove, oracle.toplink.internal.sessions.ObjectChangeSet changeSet, oracle.toplink.publicinterface.Session session)
ADVANCED: This method is used to have an object removed from a collection once the changeSet is applied The referenceKey parameter should only be used for direct Maps.
void useCollectionClass(java.lang.Class concreteClass)
PUBLIC: Configure the mapping to use an instance of the specified container class to hold the target objects.
void useMapClass(java.lang.Class concreteClass, java.lang.String methodName)
PUBLIC: It is illegal to use a Map as the container of a DirectCollectionMapping.

Methods inherited from class oracle.toplink.mappings.CollectionMapping
addAscendingOrdering, addDescendingOrdering, getRealCollectionAttributeValueFromObject, setCustomDeleteAllQuery, setDeleteAllSQLString, useSortedSetClass, useTransparentCollection, useTransparentMap

Methods inherited from class oracle.toplink.mappings.ForeignReferenceMapping
dontUseBatchReading, dontUseIndirection, getRelationshipPartnerAttributeName, privateOwnedRelationship, setCustomSelectionQuery, setIndirectionPolicy, 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

DirectCollectionMapping

public DirectCollectionMapping()
PUBLIC: Default constructor.

Method Detail

addReferenceKeyFieldName

public void addReferenceKeyFieldName(java.lang.String referenceForeignKeyFieldName,
                                     java.lang.String sourcePrimaryKeyFieldName)
PUBLIC: Add the name of the reference key field. This is used for composite reference keys. This is the foreign key field in the direct table referencing the primary key of the source object. Both the reference field name and the name of the source field that it references must be provided.

getDirectFieldName

public java.lang.String getDirectFieldName()
PUBLIC: Returns the name of the field name in the reference table.

getReferenceKeyFieldNames

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

getReferenceTableName

public java.lang.String getReferenceTableName()
PUBLIC: Returns the name of the reference table

getReferenceTableQualifiedName

public java.lang.String getReferenceTableQualifiedName()
PUBLIC: Returns the qualified name of the reference table

getSourceKeyFieldNames

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

setContainerPolicy

public void setContainerPolicy(oracle.toplink.internal.queryframework.ContainerPolicy containerPolicy)
ADVANCED: Configure the mapping to use a container policy. The policy manages the access to the collection.
Specified by:
setContainerPolicy in interface ContainerMapping
Overrides:
setContainerPolicy in class CollectionMapping

setCustomInsertQuery

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

setDirectFieldName

public void setDirectFieldName(java.lang.String fieldName)
PUBLIC: Set the direct field name in the reference table. This is the field that the primitive data value is stored in.

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 direct table. Example, 'insert into RESPONS (EMP_ID, RES_DESC) values (#EMP_ID, #RES_DESC)'.

setReferenceKeyFieldName

public void setReferenceKeyFieldName(java.lang.String fieldName)
PUBLIC: Set the name of the reference key field. This is the foreign key field in the direct table referencing the primary key of the source object. This method is used if the reference key consists of only a single field.

setReferenceKeyFieldNames

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

setReferenceTableName

public void setReferenceTableName(java.lang.String tableName)
PUBLIC: Set the reference table name.

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

simpleAddToCollectionChangeRecord

public void simpleAddToCollectionChangeRecord(java.lang.Object referenceKey,
                                              java.lang.Object objectToAdd,
                                              oracle.toplink.internal.sessions.ObjectChangeSet changeSet,
                                              oracle.toplink.publicinterface.Session session)
ADVANCED: This method is used to have an object add to a collection once the changeSet is applied The referenceKey parameter should only be used for direct Maps.
Overrides:
simpleAddToCollectionChangeRecord in class CollectionMapping

simpleRemoveFromCollectionChangeRecord

public void simpleRemoveFromCollectionChangeRecord(java.lang.Object referenceKey,
                                                   java.lang.Object objectToRemove,
                                                   oracle.toplink.internal.sessions.ObjectChangeSet changeSet,
                                                   oracle.toplink.publicinterface.Session session)
ADVANCED: This method is used to have an object removed from a collection once the changeSet is applied The referenceKey parameter should only be used for direct Maps.
Overrides:
simpleRemoveFromCollectionChangeRecord in class CollectionMapping

useCollectionClass

public void useCollectionClass(java.lang.Class concreteClass)
PUBLIC: Configure the mapping to use an instance of the specified container class to hold the target objects.

jdk1.2.x: The container class must implement (directly or indirectly) the Collection interface.

jdk1.1.x: The container class must be a subclass of Vector.

Specified by:
useCollectionClass in interface ContainerMapping
Overrides:
useCollectionClass in class CollectionMapping

useMapClass

public void useMapClass(java.lang.Class concreteClass,
                        java.lang.String methodName)
PUBLIC: It is illegal to use a Map as the container of a DirectCollectionMapping. Only Collection containers are supported for DirectCollectionMappings.
Specified by:
useMapClass in interface ContainerMapping
Overrides:
useMapClass in class CollectionMapping
See Also:
DirectMapMapping

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