EclipseLink1.0 - 20080707 API Reference

org.eclipse.persistence.mappings
Class CollectionMapping

java.lang.Object
  extended by org.eclipse.persistence.mappings.DatabaseMapping
      extended by org.eclipse.persistence.mappings.ForeignReferenceMapping
          extended by org.eclipse.persistence.mappings.CollectionMapping
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, ContainerMapping
Direct Known Subclasses:
AggregateCollectionMapping, DirectCollectionMapping, EISOneToManyMapping, ManyToManyMapping, NestedTableMapping, OneToManyMapping

public abstract class CollectionMapping
extends ForeignReferenceMapping
implements ContainerMapping

Purpose: Abstract class for relationship mappings which store collection of objects

See Also:
Serialized Form
Author:
Sati
Since:
TOPLink/Java 1.0

Field Summary
protected  org.eclipse.persistence.internal.queries.ContainerPolicy containerPolicy
           
protected  ModifyQuery deleteAllQuery
          Used for delete all in m-m, dc and delete all optimization in 1-m.
protected  boolean hasCustomDeleteAllQuery
           
protected  boolean hasOrderBy
           
 
Fields inherited from class org.eclipse.persistence.mappings.ForeignReferenceMapping
cascadeMerge, cascadePersist, cascadeRefresh, cascadeRemove, hasCustomSelectionQuery, indirectionPolicy, INNER_JOIN, isPrivateOwned, joinFetch, NONE, OUTER_JOIN, referenceClass, referenceClassName, referenceDescriptor, relationshipPartner, relationshipPartnerAttributeName, selectionQuery, tempInitSession, usesBatchReading
 
Fields inherited from class org.eclipse.persistence.mappings.DatabaseMapping
attributeAccessor, attributeName, descriptor, fields, isLazy, isOptional, isReadOnly, isRemotelyInitialized, NO_FIELDS, NO_WEIGHT, primaryKeyMapping, properties, weight, WEIGHT_1
 
Constructor Summary
CollectionMapping()
          PUBLIC: Default constructor.
 
Method Summary
 void addAggregateOrderBy(java.lang.String aggregateName, java.lang.String queryKeyName, boolean isDescending)
          PUBLIC: Provide order support for queryKeyName in ascending order.
 void addAscendingOrdering(java.lang.String queryKeyName)
          PUBLIC: Provide order support for queryKeyName in ascending order
 void addDescendingOrdering(java.lang.String queryKeyName)
          PUBLIC: Provide order support for queryKeyName in descending order.
 void addOrderBy(java.lang.String queryKeyName, boolean isDescending)
          PUBLIC: Provide order support for queryKeyName in descending or ascending order.
 void addToCollectionChangeRecord(java.lang.Object newKey, java.lang.Object newValue, org.eclipse.persistence.internal.sessions.ObjectChangeSet objectChangeSet, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow)
          INTERNAL: Add a new value and its change set to the collection change record.
 java.lang.Object buildBackupCloneForPartObject(java.lang.Object attributeValue, java.lang.Object clone, java.lang.Object backup, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork)
          INTERNAL: Used during building the backup shallow copy to copy the vector without re-registering the target objects.
 org.eclipse.persistence.internal.sessions.ChangeRecord buildChangeRecord(java.lang.Object clone, org.eclipse.persistence.internal.sessions.ObjectChangeSet owner, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Directly build a change record without comparison
 java.lang.Object buildCloneForPartObject(java.lang.Object attributeValue, java.lang.Object original, java.lang.Object clone, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork, boolean isExisting)
          INTERNAL: Require for cloning, the part must be cloned.
 void buildCopy(java.lang.Object copy, java.lang.Object original, ObjectCopyingPolicy policy)
          INTERNAL: Copy of the attribute of the object.
protected  java.lang.Object buildElementClone(java.lang.Object element, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork, boolean isExisting)
          INTERNAL: Clone the element, if necessary.
 void calculateDeferredChanges(org.eclipse.persistence.internal.sessions.ChangeRecord changeRecord, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Used by AttributeLevelChangeTracking to update a changeRecord with calculated changes as apposed to detected changes.
 void cascadeDiscoverAndPersistUnregisteredNewObjects(java.lang.Object object, java.util.Map newObjects, java.util.Map unregisteredExistingObjects, java.util.Map visitedObjects, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow)
          INTERNAL: Cascade discover and persist new objects during commit.
 void cascadeMerge(java.lang.Object sourceElement, org.eclipse.persistence.internal.sessions.MergeManager mergeManager)
          INTERNAL: Cascade the merge to the component object, if appropriate.
 void cascadePerformRemoveIfRequired(java.lang.Object object, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow, java.util.Map visitedObjects)
          INTERNAL: Cascade perform delete through mappings that require the cascade
 void cascadeRegisterNewIfRequired(java.lang.Object object, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow, java.util.Map visitedObjects)
          INTERNAL: Cascade registerNew for Create through mappings that require the cascade
 void compareCollectionsForChange(java.lang.Object oldCollection, java.lang.Object newCollection, org.eclipse.persistence.internal.sessions.ChangeRecord changeRecord, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: This method is used to calculate the differences between two collections.
 org.eclipse.persistence.internal.sessions.ChangeRecord compareForChange(java.lang.Object clone, java.lang.Object backUp, org.eclipse.persistence.internal.sessions.ObjectChangeSet owner, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: This method is used to create a change record from comparing two collections
 boolean compareObjects(java.lang.Object firstObject, java.lang.Object secondObject, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Compare the attributes belonging to this mapping for the objects.
protected  void compareObjectsAndWrite(java.lang.Object previousObjects, java.lang.Object currentObjects, WriteObjectQuery query)
          INTERNAL: The memory objects are compared and only the changes are written to the database
protected  boolean compareObjectsWithoutPrivateOwned(java.lang.Object firstCollection, java.lang.Object secondCollection, org.eclipse.persistence.internal.sessions.AbstractSession session)
          Compare two objects if their parts are not private owned
protected  boolean compareObjectsWithPrivateOwned(java.lang.Object firstCollection, java.lang.Object secondCollection, org.eclipse.persistence.internal.sessions.AbstractSession session)
          Compare two objects if their parts are private owned
 void convertClassNamesToClasses(java.lang.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.
 void fixRealObjectReferences(java.lang.Object object, java.util.Map objectDescriptors, java.util.Map processedObjects, ObjectLevelReadQuery query, RemoteSession session)
          INTERNAL: We are not using a remote valueholder so we need to replace the reference object(s) with the corresponding object(s) from the remote session.
 org.eclipse.persistence.internal.queries.ContainerPolicy getContainerPolicy()
          INTERNAL: Returns the receiver's containerPolicy.
protected  ModifyQuery getDeleteAllQuery()
           
 java.lang.Object getObjectCorrespondingTo(java.lang.Object object, RemoteSession session, java.util.Map objectDescriptors, java.util.Map processedObjects, ObjectLevelReadQuery query)
          INTERNAL: return the object on the client corresponding to the specified object.
 java.util.Vector getOrderByQueryKeyExpressions()
          INTERNAL: Return the ordering query keys.
 java.lang.Object getRealAttributeValueFromObject(java.lang.Object object, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Return the value of an attribute, unwrapping value holders if necessary.
 java.lang.Object getRealCollectionAttributeValueFromObject(java.lang.Object object, org.eclipse.persistence.internal.sessions.AbstractSession session)
          Convenience method.
protected  boolean hasCustomDeleteAllQuery()
           
 boolean hasOrderBy()
          INTERNAL: Return true if ascending or descending ordering has been set on this mapping via the @OrderBy annotation.
 void initialize(org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Initialize the state of mapping.
 boolean isAttributeValueInstantiatedOrChanged(java.lang.Object object)
          INTERNAL: The referenced object is checked if it is instantiated or not, also check if it has been changed (as indirect collections avoid instantiation on add/remove.
 boolean isChangeTrackingSupported(Project project)
          INTERNAL: Return if this mapping supports change tracking.
 boolean isCollectionMapping()
          INTERNAL:
 void iterateOnElement(org.eclipse.persistence.internal.descriptors.DescriptorIterator iterator, java.lang.Object element)
          INTERNAL: Iterate on the specified element.
 void iterateOnRealAttributeValue(org.eclipse.persistence.internal.descriptors.DescriptorIterator iterator, java.lang.Object realAttributeValue)
          INTERNAL: Iterate on the attribute value.
 void mergeChangesIntoObject(java.lang.Object target, org.eclipse.persistence.internal.sessions.ChangeRecord chgRecord, java.lang.Object source, org.eclipse.persistence.internal.sessions.MergeManager mergeManager)
          INTERNAL: Merge changes from the source to the target object.
 void mergeIntoObject(java.lang.Object target, boolean isTargetUnInitialized, java.lang.Object source, org.eclipse.persistence.internal.sessions.MergeManager mergeManager)
          INTERNAL: Merge changes from the source to the target object.
protected  void objectAddedDuringUpdate(ObjectLevelModifyQuery query, java.lang.Object objectAdded, org.eclipse.persistence.internal.sessions.ObjectChangeSet changeSet)
          INTERNAL: An object was added to the collection during an update, insert it if private.
protected  void objectRemovedDuringUpdate(ObjectLevelModifyQuery query, java.lang.Object objectDeleted)
          INTERNAL: An object was removed to the collection during an update, delete it if private.
protected  void objectUnchangedDuringUpdate(ObjectLevelModifyQuery query, java.lang.Object object)
          INTERNAL: An object is still in the collection, update it as it may have changed.
protected  void objectUnchangedDuringUpdate(ObjectLevelModifyQuery query, java.lang.Object object, java.util.Hashtable backupclones, org.eclipse.persistence.internal.identitymaps.CacheKey keys)
          INTERNAL: An object is still in the collection, update it as it may have changed.
protected  void prepareTranslationRow(org.eclipse.persistence.internal.sessions.AbstractRecord translationRow, java.lang.Object object, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: copies the non primary key information into the row currently used only in ManyToMany
protected  java.lang.Object readPrivateOwnedForObject(ObjectLevelModifyQuery modifyQuery)
          INTERNAL: All the privately owned parts are read
 void removeFromCollectionChangeRecord(java.lang.Object newKey, java.lang.Object newValue, org.eclipse.persistence.internal.sessions.ObjectChangeSet objectChangeSet, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow)
          INTERNAL: Remove a value and its change set from the collection change record.
 java.util.Map replaceValueHoldersIn(java.lang.Object object, org.eclipse.persistence.internal.sessions.remote.RemoteSessionController controller)
          INTERNAL: replace the value holders in the specified reference object(s)
 void setChangeListener(java.lang.Object clone, java.beans.PropertyChangeListener listener, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow)
          INTERNAL: Set the change listener in the collection.
 void setContainerPolicy(org.eclipse.persistence.internal.queries.ContainerPolicy containerPolicy)
          ADVANCED: Configure the mapping to use a container policy.
 void setCustomDeleteAllQuery(ModifyQuery query)
          PUBLIC: The default delete all query for mapping can be overridden by specifying the new query.
 void setDeleteAllCall(Call call)
          PUBLIC: Set the receiver's delete all call.
protected  void setDeleteAllQuery(ModifyQuery query)
           
 void setDeleteAllSQLString(java.lang.String sqlString)
          PUBLIC: Set the receiver's delete all SQL string.
protected  void setHasCustomDeleteAllQuery(boolean bool)
           
protected  void setSelectionQueryContainerPolicy(org.eclipse.persistence.internal.queries.ContainerPolicy containerPolicy)
          INTERNAL: Set the container policy on the selection query for this mapping.
 void setSessionName(java.lang.String name)
          PUBLIC: Set the name of the session to execute the mapping's queries under.
 void simpleAddToCollectionChangeRecord(java.lang.Object referenceKey, java.lang.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(java.lang.Object referenceKey, java.lang.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 updateChangeRecord(java.lang.Object clone, java.lang.Object newValue, java.lang.Object oldValue, org.eclipse.persistence.internal.sessions.ObjectChangeSet objectChangeSet, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow)
          INTERNAL: Either create a new change record or update with the new value.
 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 useCollectionClassName(java.lang.String concreteClassName)
          INTERNAL: Not sure were this is used, MW?
 void useListClassName(java.lang.String concreteClassName)
          INTERNAL: Not sure were this is used, MW?
 void useMapClass(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 keyName)
          PUBLIC: Configure the mapping to use an instance of the specified container class to hold the target objects.
 void useMapClassName(java.lang.String concreteClassName, java.lang.String methodName)
          INTERNAL: Not sure were this is used, MW?
 void useSortedSetClass(java.lang.Class concreteClass, java.util.Comparator comparator)
          PUBLIC: Configure the mapping to use an instance of the specified container class to hold the target objects.
 void useSortedSetClassName(java.lang.String className)
          INTERNAL: Configure the mapping to use an instance of the specified container class name to hold the target objects.
 void useSortedSetClassName(java.lang.String className, java.lang.String comparatorClassName)
          INTERNAL: Configure the mapping to use an instance of the specified container class name to hold the target objects.
 void useTransparentCollection()
          PUBLIC: If transparent indirection is used, a special collection will be placed in the source object's attribute.
 void useTransparentList()
          PUBLIC: If transparent indirection is used, a special collection will be placed in the source object's attribute.
 void useTransparentMap(java.lang.String methodName)
          PUBLIC: If transparent indirection is used, a special map will be placed in the source object's attribute.
 void useTransparentSet()
          PUBLIC: If transparent indirection is used, a special collection will be placed in the source object's attribute.
 void validateBeforeInitialization(org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: To validate mappings declaration
protected  java.lang.Object valueFromRowInternalWithJoin(org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager, ObjectBuildingQuery sourceQuery, org.eclipse.persistence.internal.sessions.AbstractSession executionSession)
          INTERNAL: Return the value of the field from the row or a value holder on the query to obtain the object.
 boolean verifyDelete(java.lang.Object object, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL: Checks if object is deleted from the database or not.
 
Methods inherited from class org.eclipse.persistence.mappings.ForeignReferenceMapping
batchedValueFromRow, buildBackupClone, buildClone, buildCloneFromRow, clone, createUnitOfWorkValueHolder, dontDoMerge, dontUseBatchReading, dontUseIndirection, extractResultFromBatchQuery, fixObjectReferences, getAttributeValueFromObject, getAttributeValueWithClonedValueHolders, getBatchReadObjects, getIndirectionPolicy, getJoinCriteria, getJoinFetch, getReferenceClass, getReferenceClassName, getReferenceDescriptor, getRelationshipPartner, getRelationshipPartnerAttributeName, getSelectionCriteria, getSelectionQuery, getTempSession, getValueFromRemoteValueHolder, hasCustomSelectionQuery, initializeReferenceDescriptor, initializeSelectionQuery, instantiateAttribute, isAttributeValueInstantiated, isCascadeMerge, isCascadePersist, isCascadeRefresh, isCascadeRemove, isForeignReferenceMapping, isInnerJoinFetched, isJoinFetched, isJoiningSupported, isLazy, isOuterJoinFetched, isPrivateOwned, iterate, mergeRemoteValueHolder, postPrepareNestedBatchQuery, preInitialize, prepareHistoricalQuery, prepareNestedBatchQuery, prepareNestedJoinQueryClone, prepareNestedJoins, privateOwnedRelationship, remoteInitialization, setBatchReadObjects, setCascadeAll, setCascadeMerge, setCascadePersist, setCascadeRefresh, setCascadeRemove, setCustomSelectionQuery, setHasCustomSelectionQuery, setIndirectionPolicy, setIsPrivateOwned, setJoinFetch, setRealAttributeValueInObject, setReferenceClass, setReferenceClassName, setReferenceDescriptor, setRelationshipPartner, setRelationshipPartnerAttributeName, setSelectionCall, setSelectionCriteria, setSelectionQuery, setSelectionSQLString, setTempSession, setUsesBatchReading, setUsesIndirection, shouldInitializeSelectionCriteria, shouldMergeCascadeParts, shouldMergeCascadeReference, shouldObjectModifyCascadeToParts, shouldUseBatchReading, shouldUseValueFromRowWithJoin, trimRowForJoin, trimRowForJoin, useBasicIndirection, useBatchReading, useContainerIndirection, useInnerJoinFetch, useOuterJoinFetch, usesIndirection, useWeavedIndirection, valueFromRow, valueFromRowInternal
 
Methods inherited from class org.eclipse.persistence.mappings.DatabaseMapping
buildExpression, buildObjectJoinExpression, buildObjectJoinExpression, buildShallowOriginalFromRow, cloneFields, collectFields, extractNestedExpressions, getAttributeAccessor, getAttributeClassification, getAttributeName, getDescriptor, getField, getFieldClassification, getFields, getGetMethodName, getProperties, getProperty, getSelectFields, getSelectTables, getSetMethodName, getWeight, hasConstraintDependency, hasDependency, hasInverseConstraintDependency, hasRootExpressionThatShouldUseOuterJoin, isAbstractCompositeCollectionMapping, isAbstractCompositeDirectCollectionMapping, isAbstractCompositeObjectMapping, isAbstractDirectMapping, isAggregateCollectionMapping, isAggregateMapping, isAggregateObjectMapping, isCascadedLockingSupported, isCloningRequired, isDatabaseMapping, isDirectCollectionMapping, isDirectMapMapping, isDirectToFieldMapping, isDirectToXMLTypeMapping, isEISMapping, isManyToManyMapping, isNestedTableMapping, isObjectReferenceMapping, isOneToManyMapping, isOneToOneMapping, isOptional, isPrimaryKeyMapping, isReadOnly, isReferenceMapping, isRelationalMapping, isRemotelyInitialized, isStructureMapping, isTransformationMapping, isUsingMethodAccess, isVariableOneToOneMapping, isWriteOnly, isXMLMapping, performDataModificationEvent, postDelete, postInitialize, postInsert, postUpdate, preDelete, preInsert, prepareCascadeLockingPolicy, preUpdate, readFromResultSetIntoObject, readFromRowIntoObject, readFromRowIntoObject, readOnly, readWrite, rehashFieldDependancies, remotelyInitialized, setAttributeAccessor, setAttributeName, setAttributeValueInObject, setDescriptor, setFields, setGetMethodName, setIsLazy, setIsOptional, setIsPrimaryKeyMapping, setIsReadOnly, setProperties, setProperty, setSetMethodName, setWeight, toString, validateAfterInitialization, valueFromObject, valueFromResultSet, valueFromRow, writeFromAttributeIntoRow, writeFromObjectIntoRow, writeFromObjectIntoRowForShallowInsert, writeFromObjectIntoRowForShallowInsertWithChangeRecord, writeFromObjectIntoRowForUpdate, writeFromObjectIntoRowForWhereClause, writeFromObjectIntoRowWithChangeRecord, writeInsertFieldsIntoRow, writeUpdateFieldsIntoRow
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

deleteAllQuery

protected transient ModifyQuery deleteAllQuery
Used for delete all in m-m, dc and delete all optimization in 1-m.


hasCustomDeleteAllQuery

protected transient boolean hasCustomDeleteAllQuery

containerPolicy

protected org.eclipse.persistence.internal.queries.ContainerPolicy containerPolicy

hasOrderBy

protected transient boolean hasOrderBy
Constructor Detail

CollectionMapping

public CollectionMapping()
PUBLIC: Default constructor.

Method Detail

addAscendingOrdering

public void addAscendingOrdering(java.lang.String queryKeyName)
PUBLIC: Provide order support for queryKeyName in ascending order


addDescendingOrdering

public void addDescendingOrdering(java.lang.String queryKeyName)
PUBLIC: Provide order support for queryKeyName in descending order.


addOrderBy

public void addOrderBy(java.lang.String queryKeyName,
                       boolean isDescending)
PUBLIC: Provide order support for queryKeyName in descending or ascending order. Called from the EJBAnnotationsProcessor when an @OrderBy is found.


addAggregateOrderBy

public void addAggregateOrderBy(java.lang.String aggregateName,
                                java.lang.String queryKeyName,
                                boolean isDescending)
PUBLIC: Provide order support for queryKeyName in ascending order. Called from the EJBAnnotationsProcessor when an @OrderBy on an aggregate is found.


buildBackupCloneForPartObject

public java.lang.Object buildBackupCloneForPartObject(java.lang.Object attributeValue,
                                                      java.lang.Object clone,
                                                      java.lang.Object backup,
                                                      org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork)
INTERNAL: Used during building the backup shallow copy to copy the vector without re-registering the target objects.

Specified by:
buildBackupCloneForPartObject in class ForeignReferenceMapping

buildCloneForPartObject

public java.lang.Object buildCloneForPartObject(java.lang.Object attributeValue,
                                                java.lang.Object original,
                                                java.lang.Object clone,
                                                org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork,
                                                boolean isExisting)
INTERNAL: Require for cloning, the part must be cloned. Ignore the objects, use the attribute value.

Specified by:
buildCloneForPartObject in class ForeignReferenceMapping

buildCopy

public void buildCopy(java.lang.Object copy,
                      java.lang.Object original,
                      ObjectCopyingPolicy policy)
INTERNAL: Copy of the attribute of the object. This is NOT used for unit of work but for templatizing an object.

Overrides:
buildCopy in class DatabaseMapping

buildElementClone

protected java.lang.Object buildElementClone(java.lang.Object element,
                                             org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork,
                                             boolean isExisting)
INTERNAL: Clone the element, if necessary.


cascadePerformRemoveIfRequired

public void cascadePerformRemoveIfRequired(java.lang.Object object,
                                           org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow,
                                           java.util.Map visitedObjects)
INTERNAL: Cascade perform delete through mappings that require the cascade

Specified by:
cascadePerformRemoveIfRequired in class DatabaseMapping

cascadeDiscoverAndPersistUnregisteredNewObjects

public void cascadeDiscoverAndPersistUnregisteredNewObjects(java.lang.Object object,
                                                            java.util.Map newObjects,
                                                            java.util.Map unregisteredExistingObjects,
                                                            java.util.Map visitedObjects,
                                                            org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow)
INTERNAL: Cascade discover and persist new objects during commit.

Overrides:
cascadeDiscoverAndPersistUnregisteredNewObjects in class DatabaseMapping

cascadeRegisterNewIfRequired

public void cascadeRegisterNewIfRequired(java.lang.Object object,
                                         org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow,
                                         java.util.Map visitedObjects)
INTERNAL: Cascade registerNew for Create through mappings that require the cascade

Specified by:
cascadeRegisterNewIfRequired in class DatabaseMapping

calculateDeferredChanges

public void calculateDeferredChanges(org.eclipse.persistence.internal.sessions.ChangeRecord changeRecord,
                                     org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Used by AttributeLevelChangeTracking to update a changeRecord with calculated changes as apposed to detected changes. If an attribute can not be change tracked it's changes can be detected through this process.

Overrides:
calculateDeferredChanges in class DatabaseMapping

cascadeMerge

public void cascadeMerge(java.lang.Object sourceElement,
                         org.eclipse.persistence.internal.sessions.MergeManager mergeManager)
INTERNAL: Cascade the merge to the component object, if appropriate.

Overrides:
cascadeMerge in class DatabaseMapping

compareCollectionsForChange

public void compareCollectionsForChange(java.lang.Object oldCollection,
                                        java.lang.Object newCollection,
                                        org.eclipse.persistence.internal.sessions.ChangeRecord changeRecord,
                                        org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: This method is used to calculate the differences between two collections.


compareForChange

public org.eclipse.persistence.internal.sessions.ChangeRecord compareForChange(java.lang.Object clone,
                                                                               java.lang.Object backUp,
                                                                               org.eclipse.persistence.internal.sessions.ObjectChangeSet owner,
                                                                               org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: This method is used to create a change record from comparing two collections

Specified by:
compareForChange in class DatabaseMapping
Returns:
prototype.changeset.ChangeRecord

compareObjects

public boolean compareObjects(java.lang.Object firstObject,
                              java.lang.Object secondObject,
                              org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Compare the attributes belonging to this mapping for the objects.

Overrides:
compareObjects in class ForeignReferenceMapping

compareObjectsAndWrite

protected void compareObjectsAndWrite(java.lang.Object previousObjects,
                                      java.lang.Object currentObjects,
                                      WriteObjectQuery query)
                               throws DatabaseException,
                                      OptimisticLockException
INTERNAL: The memory objects are compared and only the changes are written to the database

Throws:
DatabaseException
OptimisticLockException

compareObjectsWithoutPrivateOwned

protected boolean compareObjectsWithoutPrivateOwned(java.lang.Object firstCollection,
                                                    java.lang.Object secondCollection,
                                                    org.eclipse.persistence.internal.sessions.AbstractSession session)
Compare two objects if their parts are not private owned

Specified by:
compareObjectsWithoutPrivateOwned in class ForeignReferenceMapping

compareObjectsWithPrivateOwned

protected boolean compareObjectsWithPrivateOwned(java.lang.Object firstCollection,
                                                 java.lang.Object secondCollection,
                                                 org.eclipse.persistence.internal.sessions.AbstractSession session)
Compare two objects if their parts are private owned

Specified by:
compareObjectsWithPrivateOwned in class ForeignReferenceMapping

convertClassNamesToClasses

public void convertClassNamesToClasses(java.lang.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.

Overrides:
convertClassNamesToClasses in class ForeignReferenceMapping
Parameters:
classLoader -

fixRealObjectReferences

public void fixRealObjectReferences(java.lang.Object object,
                                    java.util.Map objectDescriptors,
                                    java.util.Map processedObjects,
                                    ObjectLevelReadQuery query,
                                    RemoteSession session)
INTERNAL: We are not using a remote valueholder so we need to replace the reference object(s) with the corresponding object(s) from the remote session.

Overrides:
fixRealObjectReferences in class DatabaseMapping

getContainerPolicy

public org.eclipse.persistence.internal.queries.ContainerPolicy getContainerPolicy()
INTERNAL: Returns the receiver's containerPolicy.

Specified by:
getContainerPolicy in interface ContainerMapping
Overrides:
getContainerPolicy in class DatabaseMapping

getDeleteAllQuery

protected ModifyQuery getDeleteAllQuery()

getObjectCorrespondingTo

public java.lang.Object getObjectCorrespondingTo(java.lang.Object object,
                                                 RemoteSession session,
                                                 java.util.Map objectDescriptors,
                                                 java.util.Map processedObjects,
                                                 ObjectLevelReadQuery query)
INTERNAL: return the object on the client corresponding to the specified object. CollectionMappings have to worry about maintaining object identity.

Overrides:
getObjectCorrespondingTo in class ForeignReferenceMapping

getOrderByQueryKeyExpressions

public java.util.Vector getOrderByQueryKeyExpressions()
INTERNAL: Return the ordering query keys. Used for Workbench integration.


getRealAttributeValueFromObject

public java.lang.Object getRealAttributeValueFromObject(java.lang.Object object,
                                                        org.eclipse.persistence.internal.sessions.AbstractSession session)
                                                 throws DescriptorException
INTERNAL: Return the value of an attribute, unwrapping value holders if necessary. Also check to ensure the collection is a vector.

Overrides:
getRealAttributeValueFromObject in class ForeignReferenceMapping
Throws:
DescriptorException

getRealCollectionAttributeValueFromObject

public java.lang.Object getRealCollectionAttributeValueFromObject(java.lang.Object object,
                                                                  org.eclipse.persistence.internal.sessions.AbstractSession session)
                                                           throws DescriptorException
Convenience method. Return the value of an attribute, unwrapping value holders if necessary. If the value is null, build a new container.

Overrides:
getRealCollectionAttributeValueFromObject in class DatabaseMapping
Throws:
DescriptorException

hasCustomDeleteAllQuery

protected boolean hasCustomDeleteAllQuery()

hasOrderBy

public boolean hasOrderBy()
INTERNAL: Return true if ascending or descending ordering has been set on this mapping via the @OrderBy annotation.


initialize

public void initialize(org.eclipse.persistence.internal.sessions.AbstractSession session)
                throws DescriptorException
INTERNAL: Initialize the state of mapping.

Overrides:
initialize in class ForeignReferenceMapping
Throws:
DescriptorException

isCollectionMapping

public boolean isCollectionMapping()
INTERNAL:

Overrides:
isCollectionMapping in class DatabaseMapping

isAttributeValueInstantiatedOrChanged

public boolean isAttributeValueInstantiatedOrChanged(java.lang.Object object)
INTERNAL: The referenced object is checked if it is instantiated or not, also check if it has been changed (as indirect collections avoid instantiation on add/remove.


iterateOnElement

public void iterateOnElement(org.eclipse.persistence.internal.descriptors.DescriptorIterator iterator,
                             java.lang.Object element)
INTERNAL: Iterate on the specified element.


iterateOnRealAttributeValue

public void iterateOnRealAttributeValue(org.eclipse.persistence.internal.descriptors.DescriptorIterator iterator,
                                        java.lang.Object realAttributeValue)
INTERNAL: Iterate on the attribute value. The value holder has already been processed.

Specified by:
iterateOnRealAttributeValue in class ForeignReferenceMapping

mergeChangesIntoObject

public void mergeChangesIntoObject(java.lang.Object target,
                                   org.eclipse.persistence.internal.sessions.ChangeRecord chgRecord,
                                   java.lang.Object source,
                                   org.eclipse.persistence.internal.sessions.MergeManager mergeManager)
INTERNAL: Merge changes from the source to the target object. Because this is a collection mapping, values are added to or removed from the collection based on the changeset

Specified by:
mergeChangesIntoObject in class DatabaseMapping

mergeIntoObject

public void mergeIntoObject(java.lang.Object target,
                            boolean isTargetUnInitialized,
                            java.lang.Object source,
                            org.eclipse.persistence.internal.sessions.MergeManager mergeManager)
INTERNAL: Merge changes from the source to the target object. This merge is only called when a changeSet for the target does not exist or the target is uninitialized

Specified by:
mergeIntoObject in class DatabaseMapping

objectAddedDuringUpdate

protected void objectAddedDuringUpdate(ObjectLevelModifyQuery query,
                                       java.lang.Object objectAdded,
                                       org.eclipse.persistence.internal.sessions.ObjectChangeSet changeSet)
                                throws DatabaseException,
                                       OptimisticLockException
INTERNAL: An object was added to the collection during an update, insert it if private.

Throws:
DatabaseException
OptimisticLockException

objectRemovedDuringUpdate

protected void objectRemovedDuringUpdate(ObjectLevelModifyQuery query,
                                         java.lang.Object objectDeleted)
                                  throws DatabaseException,
                                         OptimisticLockException
INTERNAL: An object was removed to the collection during an update, delete it if private.

Throws:
DatabaseException
OptimisticLockException

objectUnchangedDuringUpdate

protected void objectUnchangedDuringUpdate(ObjectLevelModifyQuery query,
                                           java.lang.Object object)
                                    throws DatabaseException,
                                           OptimisticLockException
INTERNAL: An object is still in the collection, update it as it may have changed.

Throws:
DatabaseException
OptimisticLockException

prepareTranslationRow

protected void prepareTranslationRow(org.eclipse.persistence.internal.sessions.AbstractRecord translationRow,
                                     java.lang.Object object,
                                     org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: copies the non primary key information into the row currently used only in ManyToMany


objectUnchangedDuringUpdate

protected void objectUnchangedDuringUpdate(ObjectLevelModifyQuery query,
                                           java.lang.Object object,
                                           java.util.Hashtable backupclones,
                                           org.eclipse.persistence.internal.identitymaps.CacheKey keys)
                                    throws DatabaseException,
                                           OptimisticLockException
INTERNAL: An object is still in the collection, update it as it may have changed.

Throws:
DatabaseException
OptimisticLockException

readPrivateOwnedForObject

protected java.lang.Object readPrivateOwnedForObject(ObjectLevelModifyQuery modifyQuery)
                                              throws DatabaseException
INTERNAL: All the privately owned parts are read

Throws:
DatabaseException

replaceValueHoldersIn

public java.util.Map replaceValueHoldersIn(java.lang.Object object,
                                           org.eclipse.persistence.internal.sessions.remote.RemoteSessionController controller)
INTERNAL: replace the value holders in the specified reference object(s)

Overrides:
replaceValueHoldersIn in class ForeignReferenceMapping

setContainerPolicy

public void setContainerPolicy(org.eclipse.persistence.internal.queries.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

setCustomDeleteAllQuery

public void setCustomDeleteAllQuery(ModifyQuery query)
PUBLIC: The default delete all query for mapping can be overridden by specifying the new query. This query is responsible for doing the deletion required by the mapping, such as deletion of all the rows from join table for M-M, or optimized delete all of target objects for 1-M.


setDeleteAllQuery

protected void setDeleteAllQuery(ModifyQuery query)

setDeleteAllSQLString

public void setDeleteAllSQLString(java.lang.String sqlString)
PUBLIC: Set the receiver's delete all 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 of all the rows from join table for M-M, or optimized delete all of target objects for 1-M. Example, 'delete from PROJ_EMP where EMP_ID = #EMP_ID'.


setDeleteAllCall

public void setDeleteAllCall(Call call)
PUBLIC: Set the receiver's delete all call. 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. This call is responsible for doing the deletion required by the mapping, such as deletion of all the rows from join table for M-M, or optimized delete all of target objects for 1-M. Example, 'new SQLCall("delete from PROJ_EMP where EMP_ID = #EMP_ID")'.


setHasCustomDeleteAllQuery

protected void setHasCustomDeleteAllQuery(boolean bool)

setSelectionQueryContainerPolicy

protected void setSelectionQueryContainerPolicy(org.eclipse.persistence.internal.queries.ContainerPolicy containerPolicy)
INTERNAL: Set the container policy on the selection query for this mapping. This method is overridden in DirectCollectionMapping since its selection query is a DataReadQuery.


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.


simpleAddToCollectionChangeRecord

public void simpleAddToCollectionChangeRecord(java.lang.Object referenceKey,
                                              java.lang.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 class DatabaseMapping

simpleRemoveFromCollectionChangeRecord

public void simpleRemoveFromCollectionChangeRecord(java.lang.Object referenceKey,
                                                   java.lang.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 class DatabaseMapping

updateChangeRecord

public void updateChangeRecord(java.lang.Object clone,
                               java.lang.Object newValue,
                               java.lang.Object oldValue,
                               org.eclipse.persistence.internal.sessions.ObjectChangeSet objectChangeSet,
                               org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow)
INTERNAL: Either create a new change record or update with the new value. This is used by attribute change tracking. Specifically in a collection mapping this will be called when the customer Set a new collection. In this case we will need to mark the change record with the new and the old versions of the collection. And mark the ObjectChangeSet with the attribute name then when the changes are calculated force a compare on the collections to determine changes.

Overrides:
updateChangeRecord in class DatabaseMapping

setChangeListener

public void setChangeListener(java.lang.Object clone,
                              java.beans.PropertyChangeListener listener,
                              org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow)
INTERNAL: Set the change listener in the collection. If the collection is not indirect it must be re-built. This is used for resuming or flushing units of work.

Overrides:
setChangeListener in class DatabaseMapping

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.

The container class must implement (directly or indirectly) the java.util.Collection interface.

Specified by:
useCollectionClass in interface ContainerMapping

useSortedSetClass

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

The container class must implement (directly or indirectly) the java.util.SortedSet interface.


useSortedSetClassName

public void useSortedSetClassName(java.lang.String className)
INTERNAL: Configure the mapping to use an instance of the specified container class name to hold the target objects. This method is used by MW.

The container class must implement (directly or indirectly) the java.util.SortedSet interface.


useSortedSetClassName

public void useSortedSetClassName(java.lang.String className,
                                  java.lang.String comparatorClassName)
INTERNAL: Configure the mapping to use an instance of the specified container class name to hold the target objects. This method is used by MW.

The container class must implement (directly or indirectly) the java.util.SortedSet interface.


useCollectionClassName

public void useCollectionClassName(java.lang.String concreteClassName)
INTERNAL: Not sure were this is used, MW?


useListClassName

public void useListClassName(java.lang.String concreteClassName)
INTERNAL: Not sure were this is used, MW?


useMapClass

public void useMapClass(java.lang.Class concreteClass,
                        java.lang.String keyName)
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 the Map 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 the Map.

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:
useMapClass in interface ContainerMapping

useMapClass

public void useMapClass(java.lang.Class concreteClass)
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 the Map is an instance of the composite primary key class.

To facilitate resolving the primary key class, the mapping's referenceClass must set before calling this method.

The container class must implement (directly or indirectly) the java.util.Map interface.


useMapClassName

public void useMapClassName(java.lang.String concreteClassName,
                            java.lang.String methodName)
INTERNAL: Not sure were this is used, MW?


useTransparentCollection

public void useTransparentCollection()
PUBLIC: If transparent indirection is used, a special collection will be placed in the source object's attribute. Fetching of the contents of the collection from the database will be delayed until absolutely necessary. (Any message sent to the collection will cause the contents to be faulted in from the database.) This can result in rather significant performance gains, without having to change the source object's attribute from Collection (or List or Vector) to ValueHolderInterface.


useTransparentSet

public void useTransparentSet()
PUBLIC: If transparent indirection is used, a special collection will be placed in the source object's attribute. Fetching of the contents of the collection from the database will be delayed until absolutely necessary. (Any message sent to the collection will cause the contents to be faulted in from the database.) This can result in rather significant performance gains, without having to change the source object's attribute from Set to ValueHolderInterface.


useTransparentList

public void useTransparentList()
PUBLIC: If transparent indirection is used, a special collection will be placed in the source object's attribute. Fetching of the contents of the collection from the database will be delayed until absolutely necessary. (Any message sent to the collection will cause the contents to be faulted in from the database.) This can result in rather significant performance gains, without having to change the source object's attribute from List to ValueHolderInterface.


useTransparentMap

public void useTransparentMap(java.lang.String methodName)
PUBLIC: If transparent indirection is used, a special map will be placed in the source object's attribute. Fetching of the contents of the map from the database will be delayed until absolutely necessary. (Any message sent to the map will cause the contents to be faulted in from the database.) This can result in rather significant performance gains, without having to change the source object's attribute from Map (or Map or Hashtable) to ValueHolderInterface.

The key used in the Map is the value returned by a call to the zero parameter method named methodName. The method should be a zero argument method implemented (or inherited) by the value to be inserted into the Map.


validateBeforeInitialization

public void validateBeforeInitialization(org.eclipse.persistence.internal.sessions.AbstractSession session)
                                  throws DescriptorException
INTERNAL: To validate mappings declaration

Overrides:
validateBeforeInitialization in class ForeignReferenceMapping
Throws:
DescriptorException

verifyDelete

public boolean verifyDelete(java.lang.Object object,
                            org.eclipse.persistence.internal.sessions.AbstractSession session)
                     throws DatabaseException
INTERNAL: Checks if object is deleted from the database or not.

Overrides:
verifyDelete in class DatabaseMapping
Throws:
DatabaseException

addToCollectionChangeRecord

public void addToCollectionChangeRecord(java.lang.Object newKey,
                                        java.lang.Object newValue,
                                        org.eclipse.persistence.internal.sessions.ObjectChangeSet objectChangeSet,
                                        org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow)
INTERNAL: Add a new value and its change set to the collection change record. This is used by attribute change tracking.

Overrides:
addToCollectionChangeRecord in class DatabaseMapping

isChangeTrackingSupported

public boolean isChangeTrackingSupported(Project project)
INTERNAL: Return if this mapping supports change tracking.

Overrides:
isChangeTrackingSupported in class DatabaseMapping

removeFromCollectionChangeRecord

public void removeFromCollectionChangeRecord(java.lang.Object newKey,
                                             java.lang.Object newValue,
                                             org.eclipse.persistence.internal.sessions.ObjectChangeSet objectChangeSet,
                                             org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow)
INTERNAL: Remove a value and its change set from the collection change record. This is used by attribute change tracking.

Overrides:
removeFromCollectionChangeRecord in class DatabaseMapping

buildChangeRecord

public org.eclipse.persistence.internal.sessions.ChangeRecord buildChangeRecord(java.lang.Object clone,
                                                                                org.eclipse.persistence.internal.sessions.ObjectChangeSet owner,
                                                                                org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Directly build a change record without comparison

Overrides:
buildChangeRecord in class DatabaseMapping

valueFromRowInternalWithJoin

protected java.lang.Object valueFromRowInternalWithJoin(org.eclipse.persistence.internal.sessions.AbstractRecord row,
                                                        org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager,
                                                        ObjectBuildingQuery sourceQuery,
                                                        org.eclipse.persistence.internal.sessions.AbstractSession executionSession)
                                                 throws DatabaseException
INTERNAL: Return the value of the field from the row or a value holder on the query to obtain the object. To get here the mapping's isJoiningSupported() should return true.

Overrides:
valueFromRowInternalWithJoin in class ForeignReferenceMapping
Throws:
DatabaseException

EclipseLink1.0 - 20080707 API Reference