Skip navigation links

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

B32476-02


oracle.toplink.mappings
Class DirectCollectionMapping

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

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

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

Purpose: This mapping is used to store a collection of simple types (String, Number, Date, etc.) into a single table. The table must store the value and a foreign key to the source object. A converter can be used if the desired object type and the data type do not match.

Since:
TOPLink/Java 1.0
See Also:
Converter, ObjectTypeConverter, TypeConversionConverter, SerializedObjectConverter, Serialized Form

Field Summary

 

Fields inherited from class oracle.toplink.mappings.ForeignReferenceMapping
INNER_JOIN, NONE, OUTER_JOIN

 

Constructor Summary
DirectCollectionMapping()
          Default constructor.

 

Method Summary
 void addReferenceKeyField(DatabaseField referenceForeignKeyField, DatabaseField sourcePrimaryKeyField)
          Add the reference key field.
 void addReferenceKeyFieldName(java.lang.String referenceForeignKeyFieldName, java.lang.String sourcePrimaryKeyFieldName)
          Add the name of the reference key field.
 java.lang.String getDirectFieldName()
          Returns the name of the field name in the reference table.
 HistoryPolicy getHistoryPolicy()
          
 java.lang.String getReferenceTableName()
          Returns the name of the reference table
 java.lang.String getReferenceTableQualifiedName()
          Returns the qualified name of the reference table
 java.util.Vector getSourceKeyFieldNames()
          Return the source key field names associated with the mapping.
 Converter getValueConverter()
          Return the converter on the mapping.
 void setContainerPolicy(oracle.toplink.internal.queryframework.ContainerPolicy containerPolicy)
          ADVANCED: Configure the mapping to use a container policy.
 void setCustomDeleteQuery(ModifyQuery query)
          The default delete query for this 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 setDeleteSQLString(java.lang.String sqlString)
          Set the receiver's delete SQL string.
 void setDirectField(DatabaseField field)
          Set the direct field in the reference table.
 void setDirectFieldClassification(java.lang.Class fieldType)
          ADVANCED: Set the class type of the field value.
 void setDirectFieldName(java.lang.String fieldName)
          Set the direct field name in the reference table.
 void setHistoryPolicy(HistoryPolicy policy)
          
 void setInsertSQLString(java.lang.String sqlString)
          Set the receiver's insert SQL string.
 void setReferenceKeyFieldName(java.lang.String fieldName)
          Set the name of the reference key field.
 void setReferenceTableName(java.lang.String tableName)
          Set the reference table name.
 void setSessionName(java.lang.String name)
          Set the name of the session to execute the mapping's queries under.
 void setValueConverter(Converter valueConverter)
          Set the converter on the mapping.
 void setValueConverterClassName(java.lang.String valueConverterClassName)
          Set the converter class name on the mapping.
 void simpleAddToCollectionChangeRecord(java.lang.Object referenceKey, java.lang.Object objectToAdd, oracle.toplink.internal.sessions.ObjectChangeSet changeSet, oracle.toplink.internal.sessions.AbstractSession 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.internal.sessions.AbstractSession 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)
          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)
          It is illegal to use a Map as the container of a DirectCollectionMapping.

 

Methods inherited from class oracle.toplink.mappings.CollectionMapping
addAggregateOrderBy, addAscendingOrdering, addDescendingOrdering, addOrderBy, getRealCollectionAttributeValueFromObject, setCustomDeleteAllQuery, setDeleteAllCall, setDeleteAllSQLString, useMapClass, useSortedSetClass, useTransparentCollection, useTransparentList, useTransparentMap, useTransparentSet

 

Methods inherited from class oracle.toplink.mappings.ForeignReferenceMapping
dontUseBatchReading, dontUseIndirection, getJoinFetch, getRelationshipPartnerAttributeName, isCascadeMerge, isCascadePersist, isCascadeRefresh, isCascadeRemove, isInnerJoinFetched, isJoinFetched, isOuterJoinFetched, privateOwnedRelationship, setCascadeAll, setCascadeMerge, setCascadePersist, setCascadeRefresh, setCascadeRemove, setCustomSelectionQuery, setIndirectionPolicy, setIsPrivateOwned, setJoinFetch, 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

DirectCollectionMapping

public DirectCollectionMapping()
Default constructor.

Method Detail

getValueConverter

public Converter getValueConverter()
Return the converter on the mapping. A converter can be used to convert between the direct collection's object value and database value.

setValueConverter

public void setValueConverter(Converter valueConverter)
Set the converter on the mapping. A converter can be used to convert between the direct collection's object value and database value.

setValueConverterClassName

public void setValueConverterClassName(java.lang.String valueConverterClassName)
Set the converter class name on the mapping. Initialized in convertClassNamesToClasses. A converter can be used to convert between the direct collection's object value and database value.

addReferenceKeyField

public void addReferenceKeyField(DatabaseField referenceForeignKeyField,
                                 DatabaseField sourcePrimaryKeyField)
Add 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 and the source field that it references must be provided.

addReferenceKeyFieldName

public void addReferenceKeyFieldName(java.lang.String referenceForeignKeyFieldName,
                                     java.lang.String sourcePrimaryKeyFieldName)
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()
Returns the name of the field name in the reference table.

getHistoryPolicy

public HistoryPolicy getHistoryPolicy()

getReferenceTableName

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

getReferenceTableQualifiedName

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

getSourceKeyFieldNames

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

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 SQL is responsible for doing the deletion required by the mapping, such as deletion from join table for M-M. Example, 'delete from RESPONS where EMP_ID = #EMP_ID and DESCRIP = #DESCRIP'.

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

setCustomDeleteQuery

public void setCustomDeleteQuery(ModifyQuery query)
The default delete query for this mapping can be overridden by specifying the new query. This query is responsible for doing the deletion required by the mapping, such as deletion from join table for M-M. The query should delete a specific row from the DirectCollectionTable bases on the DirectField.

setCustomInsertQuery

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

setDirectField

public void setDirectField(DatabaseField field)
Set the direct field in the reference table. This is the field that the primitive data value is stored in.

setDirectFieldClassification

public void setDirectFieldClassification(java.lang.Class fieldType)
ADVANCED: Set the class type of the field value. This can be used if field value differs from the object value, has specific typing requirements such as usage of java.sql.Blob or NChar. This must be called after the field name has been set.

setDirectFieldName

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

setReferenceTableName

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

setHistoryPolicy

public void setHistoryPolicy(HistoryPolicy policy)

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

simpleAddToCollectionChangeRecord

public void simpleAddToCollectionChangeRecord(java.lang.Object referenceKey,
                                              java.lang.Object objectToAdd,
                                              oracle.toplink.internal.sessions.ObjectChangeSet changeSet,
                                              oracle.toplink.internal.sessions.AbstractSession 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.internal.sessions.AbstractSession 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)
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)
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

Skip navigation links

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