Class AbstractCompositeDirectCollectionMapping
java.lang.Object
org.eclipse.persistence.core.mappings.CoreMapping<AttributeAccessor,org.eclipse.persistence.internal.sessions.AbstractSession,org.eclipse.persistence.internal.queries.ContainerPolicy,ClassDescriptor,org.eclipse.persistence.internal.helper.DatabaseField>
org.eclipse.persistence.mappings.DatabaseMapping
org.eclipse.persistence.mappings.foundation.AbstractCompositeDirectCollectionMapping
- All Implemented Interfaces:
Serializable
,Cloneable
,ContainerMapping
,ArrayCollectionMapping
- Direct Known Subclasses:
ArrayMapping
,EISCompositeDirectCollectionMapping
,XMLCompositeDirectCollectionMapping
,XMLFragmentCollectionMapping
public abstract class AbstractCompositeDirectCollectionMapping
extends DatabaseMapping
implements ContainerMapping, ArrayCollectionMapping
AbstractCompositeDirectCollectionMapping
consolidates the behavior of mappings that
map collections of "native" data objects (e.g. String
s).
These are objects that do not have their own descriptor and repeat within the XML record
for the containing object.- See Also:
- Author:
- Big Country
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.persistence.mappings.DatabaseMapping
DatabaseMapping.WriteType
-
Field Summary
Modifier and TypeFieldDescriptionprotected String
This is the "data type" associated with each element in the nested collection.protected org.eclipse.persistence.internal.helper.DatabaseField
This is the field holding the nested collection.protected Converter
Allows user defined conversion between the object value and the database value.Fields inherited from class org.eclipse.persistence.mappings.DatabaseMapping
attributeAccessor, attributeName, derivedIdMapping, derivesId, descriptor, fields, isCacheable, isInSopObject, isJPAId, isLazy, isMapKeyMapping, isOptional, isPrimaryKeyMapping, isReadOnly, isRemotelyInitialized, mapsIdValue, NO_FIELDS, NO_WEIGHT, properties, unconvertedProperties, weight, WEIGHT_AGGREGATE, WEIGHT_DIRECT, WEIGHT_TO_ONE, WEIGHT_TRANSFORM
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuildAddedElementFromChangeSet
(Object changeSet, org.eclipse.persistence.internal.sessions.MergeManager mergeManager, org.eclipse.persistence.internal.sessions.AbstractSession targetSession) INTERNAL: Build and return a new element based on the change set.void
buildBackupClone
(Object clone, Object backup, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork) INTERNAL: Clone the attribute from the clone and assign it to the backup.buildChangeSet
(Object element, org.eclipse.persistence.internal.sessions.ObjectChangeSet owner, org.eclipse.persistence.internal.sessions.AbstractSession session) INTERNAL: Build and return a change set for the specified element.void
buildClone
(Object original, org.eclipse.persistence.internal.identitymaps.CacheKey cacheKey, Object clone, Integer refreshCascade, org.eclipse.persistence.internal.sessions.AbstractSession cloningSession) INTERNAL: Clone the attribute from the original and assign it to the clone.void
buildCloneFromRow
(org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager, Object clone, org.eclipse.persistence.internal.identitymaps.CacheKey sharedCacheKey, ObjectBuildingQuery sourceQuery, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork, org.eclipse.persistence.internal.sessions.AbstractSession executionSession) INTERNAL: Extract value from the row and set the attribute to this value in the working copy clone.protected Object
buildClonePart
(Object attributeValue, org.eclipse.persistence.internal.identitymaps.CacheKey parentCacheKey, org.eclipse.persistence.internal.sessions.AbstractSession cloningSession) Build and return a clone of the specified attribute value.void
INTERNAL: Copy of the attribute of the object.protected Object
buildElementFromChangeSet
(Object changeSet, org.eclipse.persistence.internal.sessions.MergeManager mergeManager, org.eclipse.persistence.internal.sessions.AbstractSession targetSession) Build and return a new element based on the change set.buildElementFromElement
(Object object, org.eclipse.persistence.internal.sessions.MergeManager mergeManager, org.eclipse.persistence.internal.sessions.AbstractSession targetSession) INTERNAL: Build and return a new element based on the specified element.buildRemovedElementFromChangeSet
(Object changeSet, org.eclipse.persistence.internal.sessions.MergeManager mergeManager, org.eclipse.persistence.internal.sessions.AbstractSession targetSession) INTERNAL: Build and return a new element based on the change set.void
cascadePerformRemoveIfRequired
(Object object, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow, Map visitedObjects) INTERNAL: Cascade perform delete through mappings that require the cascadevoid
cascadeRegisterNewIfRequired
(Object object, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow, Map visitedObjects) INTERNAL: Cascade registerNew for Create through mappings that require the cascadeprotected Vector
Return the fields handled by the mapping.boolean
compareElements
(Object element1, Object element2, org.eclipse.persistence.internal.sessions.AbstractSession session) INTERNAL: Compare the non-null elements.boolean
compareElementsForChange
(Object element1, Object element2, org.eclipse.persistence.internal.sessions.AbstractSession session) INTERNAL: Compare the non-null elements and return true if they are alike.org.eclipse.persistence.internal.sessions.ChangeRecord
compareForChange
(Object clone, Object backup, org.eclipse.persistence.internal.sessions.ObjectChangeSet owner, org.eclipse.persistence.internal.sessions.AbstractSession session) INTERNAL: Build and return the change record that results from comparing the two direct collection attributes.boolean
compareObjects
(Object object1, Object object2, org.eclipse.persistence.internal.sessions.AbstractSession session) INTERNAL: Compare the attributes belonging to this mapping for the objects.void
convertClassNamesToClasses
(ClassLoader classLoader) INTERNAL: Convert all the class-name-based settings in this mapping to actual class-based settings This method is implemented by subclasses as necessary.protected org.eclipse.persistence.internal.sessions.ChangeRecord
convertToChangeRecord
(Object cloneCollection, org.eclipse.persistence.internal.sessions.ObjectChangeSet owner, org.eclipse.persistence.internal.sessions.AbstractSession session) createMapComponentFromRow
(org.eclipse.persistence.internal.sessions.AbstractRecord dbRow, ObjectBuildingQuery query, org.eclipse.persistence.internal.identitymaps.CacheKey parentCacheKey, org.eclipse.persistence.internal.sessions.AbstractSession session, boolean isTargetProtected) INTERNAL Called when a DatabaseMapping is used to map the key in a collection.void
fixObjectReferences
(Object object, Map objectDescriptors, Map processedObjects, ObjectLevelReadQuery query, DistributedSession session) INTERNAL: An object has been serialized from the server to the client.PUBLIC: Return the class each element in the object's collection should be converted to, before the collection is inserted into the object.org.eclipse.persistence.internal.queries.ContainerPolicy
INTERNAL: Return the mapping's containerPolicy.org.eclipse.persistence.internal.helper.DatabaseField
getField()
INTERNAL: Return the field that holds the nested collection.getFieldClassification
(org.eclipse.persistence.internal.helper.DatabaseField fieldToClassify) INTERNAL: Return the classifiction for the field contained in the mapping.PUBLIC: Return the class each element in the database row's collection should be converted to, before the collection is inserted into the database.PUBLIC: Return the name of the field that holds the nested collection.getRealCollectionAttributeValueFromObject
(Object object, org.eclipse.persistence.internal.sessions.AbstractSession session) INTERNAL: Convenience method.PUBLIC: Return the converter on the mapping.boolean
PUBLIC: Indicates if there is a converter on the mapping.void
initialize
(org.eclipse.persistence.internal.sessions.AbstractSession session) INTERNAL: Initialize the mapping.boolean
INTERNAL:boolean
INTERNAL: Related mapping should implement this method to return true.void
iterate
(org.eclipse.persistence.internal.descriptors.DescriptorIterator iterator) INTERNAL: Iterate on the appropriate attribute value.boolean
mapKeyHasChanged
(Object element, org.eclipse.persistence.internal.sessions.AbstractSession session) INTERNAL: Return whether the element's user-defined Map key has changed since it was cloned from the original version.void
mergeChangesIntoObject
(Object target, org.eclipse.persistence.internal.sessions.ChangeRecord changeRecord, Object source, org.eclipse.persistence.internal.sessions.MergeManager mergeManager, org.eclipse.persistence.internal.sessions.AbstractSession targetSession) INTERNAL: Merge changes from the source to the target object.void
mergeIntoObject
(Object target, boolean isTargetUnInitialized, Object source, org.eclipse.persistence.internal.sessions.MergeManager mergeManager, org.eclipse.persistence.internal.sessions.AbstractSession targetSession) INTERNAL: Merge changes from the source to the target object.void
setAttributeElementClass
(Class attributeElementClass) PUBLIC: Set the class each element in the object's collection should be converted to, before the collection is inserted into the object.void
setAttributeElementClassName
(String attributeElementClass) PUBLIC: Set the class each element in the object's collection should be converted to, before the collection is inserted into the object.void
setContainerPolicy
(org.eclipse.persistence.internal.queries.ContainerPolicy containerPolicy) ADVANCED: Set the mapping's containerPolicy.void
setField
(org.eclipse.persistence.internal.helper.DatabaseField field) Set the field that holds the nested collection.void
setFieldElementClass
(Class fieldElementClass) PUBLIC: Set the class each element in the database row's collection should be converted to, before the collection is inserted into the database.void
setUsesSingleNode
(boolean usesSingleNode) PUBLIC: Sets whether the mapping uses a single node.void
setValueConverter
(Converter valueConverter) PUBLIC: Set the converter on the mapping.void
simpleAddToCollectionChangeRecord
(Object referenceKey, Object changeSetToAdd, org.eclipse.persistence.internal.sessions.ObjectChangeSet changeSet, org.eclipse.persistence.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
(Object referenceKey, Object changeSetToRemove, org.eclipse.persistence.internal.sessions.ObjectChangeSet changeSet, org.eclipse.persistence.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
(Class concreteClass) PUBLIC: Configure the mapping to use an instance of the specified container class to hold the nested objects.void
useCollectionClassName
(String concreteClassName) INTERNAL: Used to set the collection class by name.void
useListClassName
(String concreteClassName) INTERNAL: Used to set the collection class by name.void
useMapClass
(Class concreteClass, String methodName) PUBLIC: Mapping does not support Map containers.void
useMapClassName
(String concreteContainerClassName, String methodName) PUBLIC: Configure the mapping to use an instance of the specified container class to hold the target objects.boolean
PUBLIC: Checks whether the mapping uses a single node.valueFromRow
(org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager, ObjectBuildingQuery sourceQuery, org.eclipse.persistence.internal.identitymaps.CacheKey cacheKey, org.eclipse.persistence.internal.sessions.AbstractSession executionSession, boolean isTargetProtected, Boolean[] wasCacheUsed) INTERNAL: Build the nested collection from the database row.void
writeFromObjectIntoRow
(Object object, org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.sessions.AbstractSession session, DatabaseMapping.WriteType writeType) INTERNAL: Get the attribute value from the object and store it in the appropriate field of the row.void
writeFromObjectIntoRowForUpdate
(WriteObjectQuery writeQuery, org.eclipse.persistence.internal.sessions.AbstractRecord row) INTERNAL: If any part of the nested collection has changed, the whole thing is written.void
writeFromObjectIntoRowWithChangeRecord
(org.eclipse.persistence.internal.sessions.ChangeRecord changeRecord, org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.sessions.AbstractSession session, DatabaseMapping.WriteType writeType) INTERNAL: Get the appropriate attribute value from the object and put it in the appropriate field of the database row.void
writeInsertFieldsIntoRow
(org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.sessions.AbstractSession session) INTERNAL: Write the fields needed for insert into the template with null values.Methods inherited from class org.eclipse.persistence.mappings.DatabaseMapping
addUnconvertedProperty, buildBackupCloneForPartObject, buildChangeRecord, buildCloneForPartObject, buildContainerClone, buildExpression, buildObjectJoinExpression, buildObjectJoinExpression, buildShallowOriginalFromRow, calculateDeferredChanges, cascadeDiscoverAndPersistUnregisteredNewObjects, cascadePerformRemovePrivateOwnedObjectFromChangeSetIfRequired, clone, cloneFields, collectQueryParameters, convertConverterClassNamesToClasses, createCloneValueHolder, derivesId, earlyPreDelete, extractNestedExpressions, extractNestedNonAggregateExpressions, fixRealObjectReferences, getAttributeAccessor, getAttributeClassification, getAttributeName, getAttributeValueFromObject, getDerivedIdMapping, getDescriptor, getFields, getGetMethodName, getMapsIdValue, getObjectCorrespondingTo, getOrderByNormalizedExpressions, getProperties, getProperty, getRealAttributeValueFromAttribute, getRealAttributeValueFromObject, getReferenceDescriptor, getRelationshipPartner, getSelectFields, getSelectTables, getSetMethodName, getUnconvertedProperties, getValueFromRemoteValueHolder, getWeight, hasConstraintDependency, hasDependency, hasInverseConstraintDependency, hasMapsIdValue, hasNestedIdentityReference, hasRootExpressionThatShouldUseOuterJoin, hasUnconvertedProperties, instantiateAttribute, isAbstractColumnMapping, isAbstractCompositeCollectionMapping, isAbstractCompositeObjectMapping, isAbstractDirectMapping, isAggregateCollectionMapping, isAggregateMapping, isAggregateObjectMapping, isAttributeValueFromObjectInstantiated, isCacheable, isCandidateForPrivateOwnedRemoval, isCascadedLockingSupported, isChangeTrackingSupported, isCloningRequired, isDatabaseMapping, isDirectCollectionMapping, isDirectMapMapping, isDirectToFieldMapping, isDirectToXMLTypeMapping, isEISMapping, isElementCollectionMapping, isForeignReferenceMapping, isInAndOutSopObject, isInOnlySopObject, isInSopObject, isJoiningSupported, isJPAId, isLazy, isLockableMapping, isManyToManyMapping, isManyToOneMapping, isMapKeyMapping, isMultitenantPrimaryKeyMapping, isNestedTableMapping, isObjectReferenceMapping, isOneToManyMapping, isOneToOneMapping, isOptional, isOutOnlySopObject, isOutSopObject, isOwned, isPrimaryKeyMapping, isPrivateOwned, isReadOnly, isReferenceMapping, isRelationalMapping, isRemotelyInitialized, isStructureMapping, isTransformationMapping, isUnidirectionalOneToManyMapping, isUsingMethodAccess, isVariableOneToOneMapping, isWriteOnly, isXMLMapping, iterateOnRealAttributeValue, load, loadAll, performDataModificationEvent, postCalculateChanges, postCalculateChangesOnDeleted, postDelete, postInitialize, postInitializeSourceAndTargetExpressions, postInsert, postUpdate, preDelete, preInitialize, preInsert, prepareCascadeLockingPolicy, preUpdate, readFromResultSetIntoObject, readFromRowIntoObject, readOnly, readWrite, recordPrivateOwnedRemovals, rehashFieldDependancies, remoteInitialization, remotelyInitialized, replaceValueHoldersIn, setAttributeAccessor, setAttributeName, setAttributeValueInObject, setChangeListener, setDerivedIdMapping, setDerivesId, setDescriptor, setFields, setGetMethodName, setIsCacheable, setIsInAndOutSopObject, setIsInSopObject, setIsJPAId, setIsLazy, setIsMapKeyMapping, setIsOptional, setIsOutSopObject, setIsPrimaryKeyMapping, setIsReadOnly, setMapsIdValue, setProperties, setProperty, setRealAttributeValueInObject, setSetMethodName, setWeight, toString, updateChangeRecord, updateCollectionChangeRecord, validateAfterInitialization, validateBeforeInitialization, valueFromObject, valueFromResultSet, valueFromRow, verifyDelete, writeFromAttributeIntoRow, writeFromObjectIntoRowForShallowInsert, writeFromObjectIntoRowForShallowInsertWithChangeRecord, writeFromObjectIntoRowForUpdateAfterShallowInsert, writeFromObjectIntoRowForUpdateBeforeShallowDelete, writeFromObjectIntoRowForWhereClause, writeUpdateFieldsIntoRow
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.persistence.mappings.structures.ArrayCollectionMapping
getAttributeName, setRealAttributeValueInObject
-
Field Details
-
field
protected org.eclipse.persistence.internal.helper.DatabaseField fieldThis is the field holding the nested collection. -
elementDataTypeName
This is the "data type" associated with each element in the nested collection. Depending on the data store, this could be optional. -
valueConverter
Allows user defined conversion between the object value and the database value.
-
-
Constructor Details
-
AbstractCompositeDirectCollectionMapping
public AbstractCompositeDirectCollectionMapping()Default constructor.
-
-
Method Details
-
getValueConverter
PUBLIC: Return the converter on the mapping. A converter can be used to convert between the direct collection's object value and database value. -
hasValueConverter
public boolean hasValueConverter()PUBLIC: Indicates if there is a converter on the mapping. -
setValueConverter
PUBLIC: Set the converter on the mapping. A converter can be used to convert between the direct collection's object value and database value. -
buildAddedElementFromChangeSet
public Object buildAddedElementFromChangeSet(Object changeSet, org.eclipse.persistence.internal.sessions.MergeManager mergeManager, org.eclipse.persistence.internal.sessions.AbstractSession targetSession) INTERNAL: Build and return a new element based on the change set.- Specified by:
buildAddedElementFromChangeSet
in interfaceArrayCollectionMapping
-
buildBackupClone
public void buildBackupClone(Object clone, Object backup, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork) INTERNAL: Clone the attribute from the clone and assign it to the backup. For these mappings, this is the same as building the first clone.- Specified by:
buildBackupClone
in classDatabaseMapping
-
buildChangeSet
public Object buildChangeSet(Object element, org.eclipse.persistence.internal.sessions.ObjectChangeSet owner, org.eclipse.persistence.internal.sessions.AbstractSession session) INTERNAL: Build and return a change set for the specified element. Direct collections simply store the element itself, since it is immutable.- Specified by:
buildChangeSet
in interfaceArrayCollectionMapping
-
buildClone
public void buildClone(Object original, org.eclipse.persistence.internal.identitymaps.CacheKey cacheKey, Object clone, Integer refreshCascade, org.eclipse.persistence.internal.sessions.AbstractSession cloningSession) INTERNAL: Clone the attribute from the original and assign it to the clone.- Specified by:
buildClone
in classDatabaseMapping
-
buildCloneFromRow
public void buildCloneFromRow(org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager, Object clone, org.eclipse.persistence.internal.identitymaps.CacheKey sharedCacheKey, ObjectBuildingQuery sourceQuery, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork, org.eclipse.persistence.internal.sessions.AbstractSession executionSession) INTERNAL: Extract value from the row and set the attribute to this value in the working copy clone. In order to bypass the shared cache when in transaction a UnitOfWork must be able to populate working copies directly from the row.- Specified by:
buildCloneFromRow
in classDatabaseMapping
-
buildClonePart
protected Object buildClonePart(Object attributeValue, org.eclipse.persistence.internal.identitymaps.CacheKey parentCacheKey, org.eclipse.persistence.internal.sessions.AbstractSession cloningSession) Build and return a clone of the specified attribute value. -
buildCopy
INTERNAL: Copy of the attribute of the object. This is NOT used for unit of work but for templatizing an object.- Overrides:
buildCopy
in classDatabaseMapping
-
buildElementFromChangeSet
protected Object buildElementFromChangeSet(Object changeSet, org.eclipse.persistence.internal.sessions.MergeManager mergeManager, org.eclipse.persistence.internal.sessions.AbstractSession targetSession) Build and return a new element based on the change set. Direct collections simply store the element itself, since it is immutable. -
buildElementFromElement
public Object buildElementFromElement(Object object, org.eclipse.persistence.internal.sessions.MergeManager mergeManager, org.eclipse.persistence.internal.sessions.AbstractSession targetSession) INTERNAL: Build and return a new element based on the specified element. Direct collections simply return the element itself, since it is immutable.- Specified by:
buildElementFromElement
in interfaceArrayCollectionMapping
-
buildRemovedElementFromChangeSet
public Object buildRemovedElementFromChangeSet(Object changeSet, org.eclipse.persistence.internal.sessions.MergeManager mergeManager, org.eclipse.persistence.internal.sessions.AbstractSession targetSession) INTERNAL: Build and return a new element based on the change set.- Specified by:
buildRemovedElementFromChangeSet
in interfaceArrayCollectionMapping
-
cascadePerformRemoveIfRequired
public void cascadePerformRemoveIfRequired(Object object, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow, Map visitedObjects) INTERNAL: Cascade perform delete through mappings that require the cascade- Specified by:
cascadePerformRemoveIfRequired
in classDatabaseMapping
-
cascadeRegisterNewIfRequired
public void cascadeRegisterNewIfRequired(Object object, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow, Map visitedObjects) INTERNAL: Cascade registerNew for Create through mappings that require the cascade- Specified by:
cascadeRegisterNewIfRequired
in classDatabaseMapping
-
collectFields
Return the fields handled by the mapping.- Overrides:
collectFields
in classDatabaseMapping
-
compareElements
public boolean compareElements(Object element1, Object element2, org.eclipse.persistence.internal.sessions.AbstractSession session) INTERNAL: Compare the non-null elements. Return true if they are alike. Use #equals() to determine if two elements are the same.- Specified by:
compareElements
in interfaceArrayCollectionMapping
-
compareElementsForChange
public boolean compareElementsForChange(Object element1, Object element2, org.eclipse.persistence.internal.sessions.AbstractSession session) INTERNAL: Compare the non-null elements and return true if they are alike.- Specified by:
compareElementsForChange
in interfaceArrayCollectionMapping
-
convertToChangeRecord
protected org.eclipse.persistence.internal.sessions.ChangeRecord convertToChangeRecord(Object cloneCollection, org.eclipse.persistence.internal.sessions.ObjectChangeSet owner, org.eclipse.persistence.internal.sessions.AbstractSession session) -
fixObjectReferences
public void fixObjectReferences(Object object, Map objectDescriptors, Map processedObjects, ObjectLevelReadQuery query, DistributedSession session) INTERNAL: An object has been serialized from the server to the client. Replace the transient attributes of the remote value holders with client-side objects.- Specified by:
fixObjectReferences
in classDatabaseMapping
-
getAttributeElementClass
PUBLIC: Return the class each element in the object's collection should be converted to, before the collection is inserted into the object. This is optional - if left null, the elements will be added to the object's collection unconverted. -
getContainerPolicy
public org.eclipse.persistence.internal.queries.ContainerPolicy getContainerPolicy()INTERNAL: Return the mapping's containerPolicy.- Specified by:
getContainerPolicy
in interfaceContainerMapping
- Overrides:
getContainerPolicy
in classDatabaseMapping
-
getField
public org.eclipse.persistence.internal.helper.DatabaseField getField()INTERNAL: Return the field that holds the nested collection.- Overrides:
getField
in classDatabaseMapping
-
isAbstractCompositeDirectCollectionMapping
public boolean isAbstractCompositeDirectCollectionMapping()INTERNAL:- Overrides:
isAbstractCompositeDirectCollectionMapping
in classDatabaseMapping
-
getFieldElementClass
PUBLIC: Return the class each element in the database row's collection should be converted to, before the collection is inserted into the database. This is optional - if left null, the elements will be added to the database row's collection unconverted. -
getFieldName
PUBLIC: Return the name of the field that holds the nested collection. -
getRealCollectionAttributeValueFromObject
public Object getRealCollectionAttributeValueFromObject(Object object, org.eclipse.persistence.internal.sessions.AbstractSession session) throws DescriptorException INTERNAL: Convenience method. Return the value of an attribute, unwrapping value holders if necessary. If the value is null, build a new container.- Specified by:
getRealCollectionAttributeValueFromObject
in interfaceArrayCollectionMapping
- Overrides:
getRealCollectionAttributeValueFromObject
in classDatabaseMapping
- Throws:
DescriptorException
-
initialize
public void initialize(org.eclipse.persistence.internal.sessions.AbstractSession session) throws DescriptorException INTERNAL: Initialize the mapping.- Overrides:
initialize
in classDatabaseMapping
- Throws:
DescriptorException
-
iterate
public void iterate(org.eclipse.persistence.internal.descriptors.DescriptorIterator iterator) INTERNAL: Iterate on the appropriate attribute value.- Specified by:
iterate
in classDatabaseMapping
-
mapKeyHasChanged
public boolean mapKeyHasChanged(Object element, org.eclipse.persistence.internal.sessions.AbstractSession session) INTERNAL: Return whether the element's user-defined Map key has changed since it was cloned from the original version. Direct elements are not allowed to have keys.- Specified by:
mapKeyHasChanged
in interfaceArrayCollectionMapping
-
setAttributeElementClass
PUBLIC: Set the class each element in the object's collection should be converted to, before the collection is inserted into the object. This is optional - if left null, the elements will be added to the object's collection unconverted. -
setAttributeElementClassName
PUBLIC: Set the class each element in the object's collection should be converted to, before the collection is inserted into the object. This is optional - if left null, the elements will be added to the object's collection unconverted. -
setContainerPolicy
public void setContainerPolicy(org.eclipse.persistence.internal.queries.ContainerPolicy containerPolicy) ADVANCED: Set the mapping's containerPolicy.- Specified by:
setContainerPolicy
in interfaceContainerMapping
-
setField
public void setField(org.eclipse.persistence.internal.helper.DatabaseField field) Set the field that holds the nested collection. -
setFieldElementClass
PUBLIC: Set the class each element in the database row's collection should be converted to, before the collection is inserted into the database. This is optional - if left null, the elements will be added to the database row's collection unconverted. -
useCollectionClass
PUBLIC: Configure the mapping to use an instance of the specified container class to hold the nested 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 interfaceContainerMapping
-
useCollectionClassName
INTERNAL: Used to set the collection class by name. This is required when building from metadata to allow the correct class loader to be used.- Specified by:
useCollectionClassName
in interfaceContainerMapping
-
useListClassName
INTERNAL: Used to set the collection class by name. This is required when building from metadata to allow the correct class loader to be used.- Specified by:
useListClassName
in interfaceContainerMapping
-
useMapClass
PUBLIC: Mapping does not support Map containers. It supports only Collection containers.- Specified by:
useMapClass
in interfaceContainerMapping
-
useMapClassName
Description copied from interface:ContainerMapping
PUBLIC: Configure the mapping to use an instance of the specified container class to hold the target objects. The key used to index a value in theMap
is the value returned by a call to the specified zero-argument method. The method must be implemented by the class (or a superclass) of any value to be inserted into theMap
.The container class must implement (directly or indirectly) the
java.util.Map
interface.To facilitate resolving the method, the mapping's referenceClass must set before calling this method.
- Specified by:
useMapClassName
in interfaceContainerMapping
-
setUsesSingleNode
public void setUsesSingleNode(boolean usesSingleNode) PUBLIC: Sets whether the mapping uses a single node.- Parameters:
usesSingleNode
- true if the items in the collection are in a single node or false if each of the items in the collection is in its own node
-
usesSingleNode
public boolean usesSingleNode()PUBLIC: Checks whether the mapping uses a single node.- Returns:
- True if the items in the collection are in a single node or false if each of the items in the collection is in its own node.
-
valueFromRow
public Object valueFromRow(org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager, ObjectBuildingQuery sourceQuery, org.eclipse.persistence.internal.identitymaps.CacheKey cacheKey, org.eclipse.persistence.internal.sessions.AbstractSession executionSession, boolean isTargetProtected, Boolean[] wasCacheUsed) throws DatabaseException INTERNAL: Build the nested collection from the database row.- Overrides:
valueFromRow
in classDatabaseMapping
- Throws:
DatabaseException
-
writeFromObjectIntoRow
public void writeFromObjectIntoRow(Object object, org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.sessions.AbstractSession session, DatabaseMapping.WriteType writeType) INTERNAL: Get the attribute value from the object and store it in the appropriate field of the row.- Overrides:
writeFromObjectIntoRow
in classDatabaseMapping
-
writeFromObjectIntoRowForUpdate
public void writeFromObjectIntoRowForUpdate(WriteObjectQuery writeQuery, org.eclipse.persistence.internal.sessions.AbstractRecord row) throws DescriptorException INTERNAL: If any part of the nested collection has changed, the whole thing is written.- Overrides:
writeFromObjectIntoRowForUpdate
in classDatabaseMapping
- Throws:
DescriptorException
-
writeFromObjectIntoRowWithChangeRecord
public void writeFromObjectIntoRowWithChangeRecord(org.eclipse.persistence.internal.sessions.ChangeRecord changeRecord, org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.sessions.AbstractSession session, DatabaseMapping.WriteType writeType) INTERNAL: Get the appropriate attribute value from the object and put it in the appropriate field of the database row. Loop through the reference objects and extract the primary keys and put them in the vector of "nested" rows.- Overrides:
writeFromObjectIntoRowWithChangeRecord
in classDatabaseMapping
-
writeInsertFieldsIntoRow
public void writeInsertFieldsIntoRow(org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.sessions.AbstractSession session) INTERNAL: Write the fields needed for insert into the template with null values.- Overrides:
writeInsertFieldsIntoRow
in classDatabaseMapping
-
getFieldClassification
public Class getFieldClassification(org.eclipse.persistence.internal.helper.DatabaseField fieldToClassify) INTERNAL: Return the classifiction for the field contained in the mapping. This is used to convert the row value to a consistent java value. By default this is unknown.- Overrides:
getFieldClassification
in classDatabaseMapping
-
isCollectionMapping
public boolean isCollectionMapping()Description copied from class:DatabaseMapping
INTERNAL: Related mapping should implement this method to return true.- Overrides:
isCollectionMapping
in classDatabaseMapping
-
convertClassNamesToClasses
Description copied from class:DatabaseMapping
INTERNAL: Convert all the class-name-based settings in this mapping to actual class-based settings This method is implemented by subclasses as necessary.- Overrides:
convertClassNamesToClasses
in classDatabaseMapping
-
compareForChange
public org.eclipse.persistence.internal.sessions.ChangeRecord compareForChange(Object clone, Object backup, org.eclipse.persistence.internal.sessions.ObjectChangeSet owner, org.eclipse.persistence.internal.sessions.AbstractSession session) INTERNAL: Build and return the change record that results from comparing the two direct collection attributes.- Specified by:
compareForChange
in classDatabaseMapping
- Returns:
- prototype.changeset.ChangeRecord
-
compareObjects
public boolean compareObjects(Object object1, Object object2, org.eclipse.persistence.internal.sessions.AbstractSession session) INTERNAL: Compare the attributes belonging to this mapping for the objects.- Specified by:
compareObjects
in classDatabaseMapping
-
mergeChangesIntoObject
public void mergeChangesIntoObject(Object target, org.eclipse.persistence.internal.sessions.ChangeRecord changeRecord, Object source, org.eclipse.persistence.internal.sessions.MergeManager mergeManager, org.eclipse.persistence.internal.sessions.AbstractSession targetSession) INTERNAL: Merge changes from the source to the target object.- Specified by:
mergeChangesIntoObject
in classDatabaseMapping
-
mergeIntoObject
public void mergeIntoObject(Object target, boolean isTargetUnInitialized, Object source, org.eclipse.persistence.internal.sessions.MergeManager mergeManager, org.eclipse.persistence.internal.sessions.AbstractSession targetSession) INTERNAL: Merge changes from the source to the target object. Simply replace the entire target collection.- Specified by:
mergeIntoObject
in classDatabaseMapping
-
simpleAddToCollectionChangeRecord
public void simpleAddToCollectionChangeRecord(Object referenceKey, Object changeSetToAdd, org.eclipse.persistence.internal.sessions.ObjectChangeSet changeSet, org.eclipse.persistence.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 classDatabaseMapping
-
simpleRemoveFromCollectionChangeRecord
public void simpleRemoveFromCollectionChangeRecord(Object referenceKey, Object changeSetToRemove, org.eclipse.persistence.internal.sessions.ObjectChangeSet changeSet, org.eclipse.persistence.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 classDatabaseMapping
-
createMapComponentFromRow
public Object createMapComponentFromRow(org.eclipse.persistence.internal.sessions.AbstractRecord dbRow, ObjectBuildingQuery query, org.eclipse.persistence.internal.identitymaps.CacheKey parentCacheKey, org.eclipse.persistence.internal.sessions.AbstractSession session, boolean isTargetProtected) INTERNAL Called when a DatabaseMapping is used to map the key in a collection. Returns the key.
-