Skip navigation links

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

B32476-02


oracle.toplink.mappings
Class DirectMapMapping

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
                  extended by oracle.toplink.mappings.DirectMapMapping

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

public class DirectMapMapping
extends DirectCollectionMapping

Mapping for a collection of key-value pairs. The key and value must be simple types (String, Number, Date, etc.) and stored in a single table along with a foreign key to the source object. A converter can be used on the key and value if the desired object types do not match the data types.

Since:
TopLink 3.5
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
DirectMapMapping()
          DirectMapCollectionMapping constructor

 

Method Summary
 java.lang.Class getKeyClass()
          This is a helper method to get the object class from the key converter if it is a TypeConversionConverter.
 Converter getKeyConverter()
          Return the converter on the mapping.
 java.lang.Class getValueClass()
          This is a helper method to get the object class from the value converter if it is a TypeConversionConverter.
 void setDirectKeyFieldName(java.lang.String fieldName)
          Set the direct key field name in the reference table.
 void setKeyClass(java.lang.Class keyClass)
          This is a helper method to set the key converter to a TypeConversionConverter.
 void setKeyConverter(Converter keyConverter)
          Set the converter on the mapping.
 void setValueClass(java.lang.Class valueClass)
          This is a helper method to set the value converter to a TypeConversionConverter.
 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 useMapClass(java.lang.Class concreteClass)
          Configure the mapping to use an instance of the specified container class to hold the target objects.
 void useTransparentMap()
          Configure the mapping to use an instance of the specified container class to hold the target objects.

 

Methods inherited from class oracle.toplink.mappings.DirectCollectionMapping
addReferenceKeyField, addReferenceKeyFieldName, getDirectFieldName, getHistoryPolicy, getReferenceClassName, getReferenceTableName, getReferenceTableQualifiedName, getSourceKeyFieldNames, getValueConverter, isRelationalMapping, setContainerPolicy, setCustomDeleteQuery, setCustomInsertQuery, setDeleteSQLString, setDirectField, setDirectFieldClassification, setDirectFieldName, setHistoryPolicy, setInsertSQLString, setReferenceClassName, setReferenceKeyFieldName, setReferenceTableName, setSessionName, setValueConverter, setValueConverterClassName, useCollectionClass, useMapClass

 

Methods inherited from class oracle.toplink.mappings.CollectionMapping
addAggregateOrderBy, addAscendingOrdering, addDescendingOrdering, addOrderBy, getRealCollectionAttributeValueFromObject, setCustomDeleteAllQuery, setDeleteAllCall, setDeleteAllSQLString, 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

DirectMapMapping

public DirectMapMapping()
DirectMapCollectionMapping constructor

Method Detail

getKeyConverter

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

setKeyConverter

public void setKeyConverter(Converter keyConverter)
Set the converter on the mapping. A converter can be used to convert between the key's object value and database value.

setDirectKeyFieldName

public void setDirectKeyFieldName(java.lang.String fieldName)
Set the direct key field name in the reference table. This is the field that the primitive data value of the Map key is stored in.

useMapClass

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

The default container class is java.util.Hashtable.

The container class must implements (directly or indirectly) the Map interface.

Note: Do not use both useMapClass(Class concreteClass), useTransparentMap(). The last use of one of the two methods will overide the previous one.

Overrides:
useMapClass in class CollectionMapping

useTransparentMap

public void useTransparentMap()
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 Map interface.

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

Note: Do not use both useMapClass(Class concreteClass), useTransparentMap(). The last use of one of the two methods will overide the previous one.


setKeyClass

public void setKeyClass(java.lang.Class keyClass)
This is a helper method to set the key converter to a TypeConversionConverter. This ensures that the key value from the database is converted to the correct Java type. The converter can also be set directly. Note that setting the converter to another converter will overwrite this setting.

getKeyClass

public java.lang.Class getKeyClass()
This is a helper method to get the object class from the key converter if it is a TypeConversionConverter. This returns null if not using a TypeConversionConverter key converter.

setValueClass

public void setValueClass(java.lang.Class valueClass)
This is a helper method to set the value converter to a TypeConversionConverter. This ensures that the value from the database is converted to the correct Java type. The converter can also be set directly. Note that setting the converter to another converter will overwrite this setting.

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 DirectCollectionMapping

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 DirectCollectionMapping

getValueClass

public java.lang.Class getValueClass()
This is a helper method to get the object class from the value converter if it is a TypeConversionConverter. This returns null if not using a TypeConversionConverter value converter.

Skip navigation links

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