Top Description Fields Constructors Methods
org.eclipse.persistence.mappings

public Class DirectMapMapping

extends DirectCollectionMapping
implements MapComponentMapping
Class Inheritance
All Implemented Interfaces
org.eclipse.persistence.mappings.foundation.MapComponentMapping
Imports
java.util.HashMap, .HashSet, .Iterator, .List, .Map, .Set, org.eclipse.persistence.descriptors.changetracking.ChangeTracker, .CollectionChangeEvent, .MapChangeEvent, org.eclipse.persistence.exceptions.DatabaseException, .DescriptorException, .ValidationException, org.eclipse.persistence.expressions.Expression, .ExpressionBuilder, org.eclipse.persistence.indirection.IndirectCollection, .ValueHolder, org.eclipse.persistence.internal.descriptors.DescriptorIterator, .ObjectBuilder, org.eclipse.persistence.internal.descriptors.changetracking.AttributeChangeListener, .ObjectChangeListener, org.eclipse.persistence.internal.expressions.SQLDeleteStatement, .SQLSelectStatement, org.eclipse.persistence.internal.helper.ClassConstants, .DatabaseField, .Helper, org.eclipse.persistence.internal.identitymaps.CacheKey, org.eclipse.persistence.internal.indirection.TransparentIndirectionPolicy, org.eclipse.persistence.internal.queries.ContainerPolicy, .JoinedAttributeManager, .MappedKeyMapContainerPolicy, org.eclipse.persistence.internal.sessions.AbstractRecord, .AbstractSession, .ChangeRecord, .DirectMapChangeRecord, .MergeManager, .ObjectChangeSet, .UnitOfWorkImpl, org.eclipse.persistence.mappings.converters.Converter, .ObjectTypeConverter, .SerializedObjectConverter, .TypeConversionConverter, org.eclipse.persistence.mappings.foundation.MapComponentMapping, org.eclipse.persistence.queries.DataReadQuery, .DatabaseQuery, .DeleteObjectQuery, .DirectReadQuery, .ObjectBuildingQuery, .ReadAllQuery, .WriteObjectQuery, org.eclipse.persistence.sessions.DatabaseRecord

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.
Author
Steven Vo
Since
TopLink 3.5
See Also
Converter, ObjectTypeConverter, TypeConversionConverter, SerializedObjectConverter

Field Summary

Inherited from org.eclipse.persistence.mappings.DirectCollectionMapping:
attributeClassificationattributeClassificationNamechangeSetDeleteNullQuerychangeSetDeleteQueryDeleteDeleteAllDeleteAtIndexdeleteAtIndexQuerydirectFieldhasCustomDeleteAtIndexQueryhasCustomDeleteQueryhasCustomInsertQueryhasCustomUpdateAtIndexQueryhistoryPolicyInsertinsertQueryorderByExpressionsreferenceKeyFieldsreferenceTablesourceKeyFieldsUpdateAtIndexupdateAtIndexQueryvalueConvertervalueConverterClassName

Constructor Summary

AccessConstructor and Description
public
DirectMapMapping()

DirectMapCollectionMapping constructor

Method Summary

Modifier and TypeMethod and Description
public void
addToCollectionChangeRecord(Object newKey, Object newValue, ObjectChangeSet objectChangeSet, UnitOfWorkImpl uow)

INTERNAL: Add a new value and its change set to the collection change record.

public Object
buildCloneForPartObject(Object
TODO
attributeValue
,
Object
TODO
original
,
CacheKey
TODO
cacheKey
,
Object
TODO
clone
,
AbstractSession
TODO
cloningSession
,
Integer
TODO
refreshCascade
,
boolean
TODO
isExisting
,
boolean
TODO
isFromSharedCache
)

Overrides org.eclipse.persistence.mappings.CollectionMapping.buildCloneForPartObject.

INTERNAL: Require for cloning, the part must be cloned.
public void
calculateDeferredChanges(ChangeRecord
TODO
changeRecord
,
AbstractSession
TODO
session
)

Overrides org.eclipse.persistence.mappings.DirectCollectionMapping.calculateDeferredChanges.

INTERNAL: Used by AttributeLevelChangeTracking to update a changeRecord with calculated changes as opposed to detected changes.
public void
cascadeDiscoverAndPersistUnregisteredNewObjects(Object
TODO
object
,
Map<K, V>
TODO
newObjects
,
Map<K, V>
TODO
unregisteredExistingObjects
,
Map<K, V>
TODO
visitedObjects
,
UnitOfWorkImpl
TODO
uow
,
Set<E>
TODO
cascadeErrors
)

Overrides org.eclipse.persistence.mappings.DirectCollectionMapping.cascadeDiscoverAndPersistUnregisteredNewObjects.

INTERNAL: Cascade discover and persist new objects during commit.
public void
cascadePerformRemoveIfRequired(Object
TODO
object
,
UnitOfWorkImpl
TODO
uow
,
Map<K, V>
TODO
visitedObjects
)

Overrides org.eclipse.persistence.mappings.DirectCollectionMapping.cascadePerformRemoveIfRequired.

INTERNAL: Cascade perform delete through mappings that require the cascade
public void
cascadeRegisterNewIfRequired(Object
TODO
object
,
UnitOfWorkImpl
TODO
uow
,
Map<K, V>
TODO
visitedObjects
)

Overrides org.eclipse.persistence.mappings.DirectCollectionMapping.cascadeRegisterNewIfRequired.

INTERNAL: Cascade registerNew for Create through mappings that require the cascade
public void
compareCollectionsForChange(Object oldCollection, Object newCollection, ChangeRecord changeRecord, AbstractSession session)

Overrides org.eclipse.persistence.mappings.DirectCollectionMapping.compareCollectionsForChange.

INTERNAL: This method is used to calculate the differences between two collections.
public ChangeRecord
compareForChange(Object
TODO
clone
,
Object
TODO
backUp
,
ObjectChangeSet
TODO
owner
,
AbstractSession
TODO
session
)

Overrides org.eclipse.persistence.mappings.DirectCollectionMapping.compareForChange.

INTERNAL: This method compares the changes between two direct collections.
public boolean
compareObjects(Object
TODO
firstObject
,
Object
TODO
secondObject
,
AbstractSession
TODO
session
)

Overrides org.eclipse.persistence.mappings.DirectCollectionMapping.compareObjects.

INTERNAL: Compare the attributes belonging to this mapping for the objects.
public void
convertClassNamesToClasses(ClassLoader
TODO
classLoader
)

Overrides org.eclipse.persistence.mappings.DirectCollectionMapping.convertClassNamesToClasses.

INTERNAL: Convert all the class-name-based settings in this mapping to actual class-based settings This method is implemented by subclasses as necessary.
public Object
createMapComponentFromRow(AbstractRecord dbRow, ObjectBuildingQuery query, CacheKey parentCacheKey, AbstractSession session, boolean isTargetProtected)

Implements org.eclipse.persistence.mappings.foundation.MapComponentMapping.createMapComponentFromRow.

INTERNAL Called when a DatabaseMapping is used to map the key in a collection.
protected void
executeBatchQuery(DatabaseQuery query, CacheKey parentCacheKey, Map<K, V> referenceDataByKey, AbstractSession session, AbstractRecord translationRow)

Overrides org.eclipse.persistence.mappings.DirectCollectionMapping.executeBatchQuery.

INTERNAL: Prepare and execute the batch query and store the results for each source object in a map keyed by the mappings source keys of the source objects.
public DatabaseField
getDirectKeyField()

INTERNAL:

public Class<?>
getKeyClass()

PUBLIC: This is a helper method to get the object class from the key converter if it is a TypeConversionConverter.

public Converter
getKeyConverter()

PUBLIC: Return the converter on the mapping.

private MappedKeyMapContainerPolicy
public Class<?>
getValueClass()

PUBLIC: This is a helper method to get the object class from the value converter if it is a TypeConversionConverter.

public void
initialize(AbstractSession session)

Overrides org.eclipse.persistence.mappings.DirectCollectionMapping.initialize.

INTERNAL: Initialize and validate the mapping properties.
protected void
protected void
protected void
protected void
public boolean
isDirectMapMapping()

Overrides org.eclipse.persistence.mappings.DatabaseMapping.isDirectMapMapping.

INTERNAL: Related mapping should implement this method to return true.
public void
iterateOnElement(DescriptorIterator iterator, Object element)

Overrides org.eclipse.persistence.mappings.DirectCollectionMapping.iterateOnElement.

INTERNAL: Iterate on the specified element.
public void
public void
mergeChangesIntoObject(Object target, ChangeRecord changeRecord, Object source, MergeManager mergeManager, AbstractSession targetSession)

Overrides org.eclipse.persistence.mappings.DirectCollectionMapping.mergeChangesIntoObject.

INTERNAL: Merge changes from the source to the target object.
public void
mergeIntoObject(Object target, boolean isTargetUnInitialized, Object source, MergeManager mergeManager, AbstractSession targetSession)

Overrides org.eclipse.persistence.mappings.DirectCollectionMapping.mergeIntoObject.

INTERNAL: Merge changes from the source to the target object.
public void
public void
postCalculateChanges(ChangeRecord changeRecord, UnitOfWorkImpl uow)

Overrides org.eclipse.persistence.mappings.DirectCollectionMapping.postCalculateChanges.

INTERNAL: Overridden by mappings that require additional processing of the change record after the record has been calculated.
public void
postInsert(WriteObjectQuery query)

Overrides org.eclipse.persistence.mappings.DirectCollectionMapping.postInsert.

INTERNAL: Insert the private owned object.
protected void
public void
preDelete(DeleteObjectQuery query)

Overrides org.eclipse.persistence.mappings.DirectCollectionMapping.preDelete.

INTERNAL: Propagate the preDelete event through the container policy if necessary
public void
recordPrivateOwnedRemovals(Object object, UnitOfWorkImpl uow)

Overrides org.eclipse.persistence.mappings.DirectCollectionMapping.recordPrivateOwnedRemovals.

INTERNAL: Overridden by mappings that require additional processing of the change record after the record has been calculated.
protected void
removeFromCollectionChangeRecord(Object newKey, Object newValue, ObjectChangeSet objectChangeSet, UnitOfWorkImpl uow)

INTERNAL: Remove a value and its change set from the collection change record.

public void
public void
setDirectKeyField(DatabaseField keyField)

INTERNAL:

public void
setDirectKeyFieldClassification(Class<?> fieldType)

ADVANCED: Set the class type of the field value.

public void
setDirectKeyFieldClassificationName(String fieldTypeName)

ADVANCED: Set the class type name of the field value.

public void
setDirectKeyFieldName(String fieldName)

PUBLIC: Set the direct key field name in the reference table.

public void
setKeyClass(Class<?> keyClass)

PUBLIC: This is a helper method to set the key converter to a TypeConversionConverter.

public void
setKeyConverter(Converter keyConverter)

PUBLIC: Set the converter on the mapping.

public void
setKeyConverterClassName(String keyConverterClassName)

INTERNAL: Set the converter class name on the mapping.

public void
setValueClass(Class<?> valueClass)

PUBLIC: This is a helper method to set the value converter to a TypeConversionConverter.

public void
simpleAddToCollectionChangeRecord(Object referenceKey, Object objectToAdd, ObjectChangeSet changeSet, AbstractSession session)

Overrides org.eclipse.persistence.mappings.DirectCollectionMapping.simpleAddToCollectionChangeRecord.

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.
public void
simpleRemoveFromCollectionChangeRecord(Object referenceKey, Object objectToRemove, ObjectChangeSet changeSet, AbstractSession session)

Overrides org.eclipse.persistence.mappings.DirectCollectionMapping.simpleRemoveFromCollectionChangeRecord.

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.
public void
updateChangeRecord(Object clone, Object newValue, Object oldValue, ObjectChangeSet objectChangeSet, UnitOfWorkImpl uow)

Overrides org.eclipse.persistence.mappings.DirectCollectionMapping.updateChangeRecord.

INTERNAL: Either create a new change record or update the change record with the new value.
public void
updateCollectionChangeRecord(CollectionChangeEvent event, ObjectChangeSet changeSet, UnitOfWorkImpl uow)

Overrides org.eclipse.persistence.mappings.DirectCollectionMapping.updateCollectionChangeRecord.

INTERNAL: Add or removes a new value and its change set to the collection change record based on the event passed in. This is used by attribute change tracking.
public void
useMapClass(Class<?> concreteClass)

Overrides org.eclipse.persistence.mappings.CollectionMapping.useMapClass.

PUBLIC: Configure the mapping to use an instance of the specified container class to hold the target objects.
public void
useTransparentMap()

PUBLIC: Configure the mapping to use an instance of the specified container class to hold the target objects.

protected Object
valueFromRowInternalWithJoin(AbstractRecord row, JoinedAttributeManager joinManager, ObjectBuildingQuery sourceQuery, CacheKey parentCacheKey, AbstractSession executionSession, boolean isTargetProtected)

Overrides org.eclipse.persistence.mappings.DirectCollectionMapping.valueFromRowInternalWithJoin.

INTERNAL: Return the value of the field from the row or a value holder on the query to obtain the object.
Inherited from org.eclipse.persistence.mappings.DirectCollectionMapping:
addAscendingOrderingaddDescendingOrderingaddOrderingaddReferenceKeyFieldaddReferenceKeyFieldNamebuildBatchCriteriabuildCopybuildElementClonebuildExpressionbuildListOrderFieldcascadePerformRemovePrivateOwnedObjectFromChangeSetIfRequiredclonecollectQueryParameterscompareListscompareListsForChangecreateWhereClauseForDeleteNullQuerycreateWhereClauseForDeleteQueryextractBatchKeyFromRowextractKeyFromTargetRowfixRealObjectReferencesgetAdditionalFieldsBaseExpressiongetAttributeClassificationgetAttributeClassificationNamegetDeleteAtIndexQuerygetDeleteNullQuerygetDeleteQuerygetDirectFieldgetDirectFieldNamegetFieldsForTranslationInAggregategetFieldValuegetHistoryPolicygetInsertQuerygetJoinCriteriagetObjectCorrespondingTogetObjectValuegetOrderByExpressionsgetOrderByNormalizedExpressionsgetReferenceClassgetReferenceClassNamegetReferenceDescriptorgetReferenceKeyFieldNamesgetReferenceKeyFieldsgetReferenceTablegetReferenceTableNamegetReferenceTableQualifiedNamegetRelationshipPartnergetSelectFieldsgetSelectionQueryContainerPolicygetSelectTablesgetSourceKeyFieldNamesgetSourceKeyFieldsgetUpdateAtIndexQuerygetValueConverterhasCustomDeleteAtIndexQueryhasCustomDeleteQueryhasCustomInsertQueryhasCustomUpdateAtIndexQueryhasNestedIdentityReferenceinitializeDeleteAllQueryinitializeDeleteAtIndexQueryinitializeDeleteNullQueryinitializeDirectFieldinitializeListOrderFieldinitializeReferenceDescriptorinitializeReferenceKeysinitializeReferenceTableinitializeSelectionCriteriainitializeSelectionQueryinitializeSourceKeysinitializeSourceKeysWithDefaultsinitializeUpdateAtIndexQueryisCandidateForPrivateOwnedRemovalisCascadedLockingSupportedisDirectCollectionMappingisElementCollectionMappingisJoiningSupportedisKeyForSourceSpecifiedisLockableMappingisOwnedisRelationalMappingmergeAddRemoveChangespostUpdatepostUpdateWithChangeSetListOrderprepareNestedBatchQueryprepareNestedJoinsprepareTranslationRowremoteInitializationreplaceValueHoldersInsetAttributeClassificationsetAttributeClassificationNamesetCustomDeleteAtIndexQuerysetCustomDeleteQuerysetCustomInsertQuerysetCustomUpdateAtIndexQuerysetDeleteQuerysetDeleteSQLStringsetDirectFieldsetDirectFieldClassificationsetDirectFieldClassificationNamesetDirectFieldNamesetHasCustomDeleteQuerysetHasCustomInsertQuerysetHistoryPolicysetInsertQuerysetInsertSQLStringsetReferenceClasssetReferenceClassNamesetReferenceKeyFieldNamesetReferenceKeyFieldNamessetReferenceKeyFieldssetReferenceTablesetReferenceTableNamesetSelectionCriteriasetSelectionQueryContainerPolicysetSessionNamesetSourceKeyFieldNamessetSourceKeyFieldssetValueConvertersetValueConverterClassNameshouldUseListOrderFieldTableExpressionsimpleAddToCollectionChangeRecordsimpleRemoveFromCollectionChangeRecorduseMapClassvalueFromRowverifyDelete