Class CollectionMapping
- All Implemented Interfaces:
Serializable
,Cloneable
,ContainerMapping
- Direct Known Subclasses:
AggregateCollectionMapping
,DirectCollectionMapping
,EISOneToManyMapping
,ManyToManyMapping
,NestedTableMapping
,OneToManyMapping
Purpose: Abstract class for relationship mappings which store collection of objects
- See Also:
- Author:
- Sati
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.persistence.mappings.DatabaseMapping
DatabaseMapping.WriteType
-
Field Summary
Modifier and TypeFieldDescriptionprotected DataModifyQuery
Query used when order of list members is changed.protected org.eclipse.persistence.internal.queries.ContainerPolicy
protected ModifyQuery
Used for delete all in m-m, dc and delete all optimization in 1-m.protected boolean
protected boolean
protected boolean
Indicates whether the mapping supports listOrderField, if it doesn't attempt to set listOrderField throws exception.protected static boolean
Flag to indicate if collection needs to be synchronized instead of cloning during merge.protected org.eclipse.persistence.internal.helper.DatabaseField
Field holds the order of elements in the list in the db, requires collection of type List, may be not null only in case isListOrderFieldSupported==trueprotected Boolean
Store if the mapping can batch delete reference objects.protected OrderCorrectionType
Specifies what should be done if the list of values read from listOrserField is invalid (there should be no nulls, no duplicates, no "holes").Fields inherited from class org.eclipse.persistence.mappings.ForeignReferenceMapping
batchFetchType, cascadeDetach, cascadeMerge, cascadePersist, cascadeRefresh, cascadeRemove, forceInitializationOfSelectionCriteria, hasCustomSelectionQuery, indirectionPolicy, INNER_JOIN, isCascadeOnDeleteSetOnDatabase, isPrivateOwned, joinFetch, mappedBy, NONE, OUTER_JOIN, partitioningPolicy, partitioningPolicyName, QUERY_BATCH_PARAMETER, referenceClass, referenceClassName, referenceDescriptor, relationshipPartner, relationshipPartnerAttributeName, requiresTransientWeavedFields, selectionQuery, tempInitSession
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 TypeMethodDescriptionvoid
addAggregateOrderBy
(String aggregateName, String queryKeyName, boolean isDescending) PUBLIC: Provide order support for queryKeyName in ascending or descending order.void
addAscendingOrdering
(String queryKeyName) PUBLIC: Provide order support for queryKeyName in ascending ordervoid
addDescendingOrdering
(String queryKeyName) PUBLIC: Provide order support for queryKeyName in descending order.void
addOrderBy
(String queryKeyName, boolean isDescending) PUBLIC: Provide order support for queryKeyName in descending or ascending order.buildBackupCloneForPartObject
(Object attributeValue, Object clone, 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
(Object clone, org.eclipse.persistence.internal.sessions.ObjectChangeSet owner, org.eclipse.persistence.internal.sessions.AbstractSession session) INTERNAL: Directly build a change record without comparisonbuildCloneForPartObject
(Object attributeValue, Object original, org.eclipse.persistence.internal.identitymaps.CacheKey cacheKey, Object clone, org.eclipse.persistence.internal.sessions.AbstractSession cloningSession, Integer refreshCascade, boolean isExisting, boolean isFromSharedCache) INTERNAL: Require for cloning, the part must be cloned.buildContainerClone
(Object attributeValue, org.eclipse.persistence.internal.sessions.AbstractSession cloningSession) INTERNAL: Performs a first level clone of the attribute.void
INTERNAL: Copy of the attribute of the object.buildElementClone
(Object element, Object parent, org.eclipse.persistence.internal.identitymaps.CacheKey parentCacheKey, Integer refreshCascade, org.eclipse.persistence.internal.sessions.AbstractSession cloningSession, boolean isExisting, boolean isFromSharedCache) INTERNAL: Clone the element, if necessary.buildElementUnitOfWorkClone
(Object element, Object parent, Integer refreshCascade, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork, boolean isExisting, boolean isFromSharedCache) INTERNAL: Clone the element, if necessary.buildExpression
(Object queryObject, QueryByExamplePolicy policy, Expression expressionBuilder, Map processedObjects, org.eclipse.persistence.internal.sessions.AbstractSession session) INTERNAL: In case Query By Example is used, this method generates an expression from a attribute value pair.protected void
INTERNAL: Verifies listOrderField's table, if none found sets the default one.Object[]
buildReferencesPKList
(Object entity, Object attribute, org.eclipse.persistence.internal.sessions.AbstractSession session) INTERNAL: This method will access the target relationship and create a list of information to rebuild the relationship.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
(Object object, Map newObjects, Map unregisteredExistingObjects, Map visitedObjects, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow, Set cascadeErrors) INTERNAL: Cascade discover and persist new objects during commit.void
cascadePerformRemoveIfRequired
(Object object, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow, Map visitedObjects) INTERNAL: Cascade perform delete through mappings that require the cascadevoid
cascadePerformRemovePrivateOwnedObjectFromChangeSetIfRequired
(Object object, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow, Map visitedObjects) INTERNAL: Cascade perform removal of orphaned private owned objects from the UnitOfWorkChangeSetvoid
cascadeRegisterNewIfRequired
(Object object, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow, Map visitedObjects) INTERNAL: Cascade registerNew for Create through mappings that require the cascadeclone()
INTERNAL: The mapping clones itself to create deep copy.void
collectQueryParameters
(Set<org.eclipse.persistence.internal.helper.DatabaseField> record) INTERNAL: This method is used to store the FK fields that can be cached that correspond to noncacheable mappings the FK field values will be used to re-issue the query when cloning the shared cache entityvoid
compareCollectionsForChange
(Object oldCollection, 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
(Object clone, 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.protected boolean
compareLists
(List firstList, List secondList, org.eclipse.persistence.internal.sessions.AbstractSession session, boolean withPrivateOwned) Compare two lists.protected void
compareListsAndWrite
(List previousList, List currentList, WriteObjectQuery query) INTERNAL: Old and new lists are compared and only the changes are written to the database.boolean
compareObjects
(Object firstObject, Object secondObject, org.eclipse.persistence.internal.sessions.AbstractSession session) INTERNAL: Compare the attributes belonging to this mapping for the objects.protected void
INTERNAL: The memory objects are compared and only the changes are written to the database.protected boolean
compareObjectsWithoutPrivateOwned
(Object firstCollection, Object secondCollection, org.eclipse.persistence.internal.sessions.AbstractSession session) Compare two objects if their parts are not private ownedprotected boolean
compareObjectsWithPrivateOwned
(Object firstCollection, Object secondCollection, org.eclipse.persistence.internal.sessions.AbstractSession session) Compare two objects if their parts are private ownedvoid
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 Object
copyElement
(Object original, CopyGroup group) INTERNAL: Copies member's valueprotected void
executeBatchQuery
(DatabaseQuery query, org.eclipse.persistence.internal.identitymaps.CacheKey parentCacheKey, Map referenceObjectsByKey, org.eclipse.persistence.internal.sessions.AbstractSession session, org.eclipse.persistence.internal.sessions.AbstractRecord translationRow) 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.protected Object
extractKeyFromTargetRow
(org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.sessions.AbstractSession session) INTERNAL: Extract the source primary key value from the target row.extractResultFromBatchQuery
(ReadQuery batchQuery, org.eclipse.persistence.internal.identitymaps.CacheKey parentCacheKey, org.eclipse.persistence.internal.sessions.AbstractRecord sourceRow, org.eclipse.persistence.internal.sessions.AbstractSession session, ObjectLevelReadQuery originalQuery) INTERNAL: Extract the value from the batch optimized query, this should be supported by most query types.void
fixRealObjectReferences
(Object object, Map objectDescriptors, Map processedObjects, ObjectLevelReadQuery query, DistributedSession 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.protected Expression
INTERNAL: Return the base expression to use for adding fields to the query.org.eclipse.persistence.internal.queries.ContainerPolicy
INTERNAL: Returns the receiver's containerPolicy.protected ModifyQuery
getJoinCriteria
(org.eclipse.persistence.internal.expressions.ObjectExpression context, Expression base) INTERNAL: Returns the join criteria stored in the mapping selection query.org.eclipse.persistence.internal.helper.DatabaseField
PUBLIC: Field holds the order of elements in the list in the db, requires collection of type List; may be not null only in case isListOrderFieldSupported==true.getObjectCorrespondingTo
(Object object, DistributedSession session, Map objectDescriptors, Map processedObjects, ObjectLevelReadQuery query) INTERNAL: return the object on the client corresponding to the specified object.INTERNAL: Return the ordering query keys.PUBLIC: Specifies what should be done if the list of values read from listOrserField is invalid (there should be no nulls, no duplicates, no "holes").getRealCollectionAttributeValueFromObject
(Object object, org.eclipse.persistence.internal.sessions.AbstractSession session) Convenience method.protected org.eclipse.persistence.internal.queries.ContainerPolicy
INTERNAL: Get the container policy from the selection query for this mapping.List<org.eclipse.persistence.internal.helper.DatabaseField>
INTERNAL: Returns list of primary key fields from the reference descriptor.protected boolean
boolean
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.protected void
initializeChangeOrderTargetQuery
(org.eclipse.persistence.internal.sessions.AbstractSession session) INTERNAL: Initialize changeOrderTargetQuery.protected void
initializeListOrderField
(org.eclipse.persistence.internal.sessions.AbstractSession session) INTERNAL: Initializes listOrderField.protected void
initializeListOrderFieldTable
(org.eclipse.persistence.internal.sessions.AbstractSession session) INTERNAL: Initializes listOrderField's table, does nothing by default.boolean
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
INTERNAL: Return whether this mapping is a Collection type.boolean
PUBLIC: indicates whether the mapping supports listOrderField, if it doesn't attempt to set listOrderField throws exception.boolean
INTERNAL: Return if this mapping has a mapped key that uses a OneToOne (object).void
iterateOnElement
(org.eclipse.persistence.internal.descriptors.DescriptorIterator iterator, Object element) INTERNAL: Iterate on the specified element.void
iterateOnRealAttributeValue
(org.eclipse.persistence.internal.descriptors.DescriptorIterator iterator, Object realAttributeValue) INTERNAL: Iterate on the attribute value.void
load
(Object object, org.eclipse.persistence.internal.queries.AttributeItem item, org.eclipse.persistence.internal.sessions.AbstractSession session, boolean fromFetchGroup) Force instantiation of the load group.void
loadAll
(Object object, org.eclipse.persistence.internal.sessions.AbstractSession session, org.eclipse.persistence.internal.helper.IdentityHashSet loaded) Force instantiation of all indirections.void
mergeChangesIntoObject
(Object target, org.eclipse.persistence.internal.sessions.ChangeRecord chgRecord, 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.boolean
ADVANCED: Return whether the reference objects must be deleted one by one, as opposed to with a single DELETE statement.protected void
objectAddedDuringUpdate
(ObjectLevelModifyQuery query, Object objectAdded, org.eclipse.persistence.internal.sessions.ObjectChangeSet changeSet, Map extraData) INTERNAL: An object was added to the collection during an update, insert it if private.protected void
objectOrderChangedDuringUpdate
(WriteObjectQuery query, Object orderChangedObject, int orderIndex) protected void
objectRemovedDuringUpdate
(ObjectLevelModifyQuery query, Object objectDeleted, Map extraData) INTERNAL: An object was removed to the collection during an update, delete it if private.protected void
objectUnchangedDuringUpdate
(ObjectLevelModifyQuery query, Object object) INTERNAL: An object is still in the collection, update it as it may have changed.protected void
objectUnchangedDuringUpdate
(ObjectLevelModifyQuery query, Object object, Map backupclones, Object key) INTERNAL: An object is still in the collection, update it as it may have changed.void
postCalculateChanges
(ChangeRecord changeRecord, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow) INTERNAL: Overridden by mappings that require additional processing of the change record after the record has been calculated.void
postDelete
(DeleteObjectQuery query) INTERNAL: A subclass should implement this method if it wants different behavior.void
postInitialize
(org.eclipse.persistence.internal.sessions.AbstractSession session) INTERNAL: Ensure the container policy is post initializedvoid
postInsert
(WriteObjectQuery query) INTERNAL: A subclass should implement this method if it wants different behavior.protected void
postPrepareNestedBatchQuery
(ReadQuery batchQuery, ObjectLevelReadQuery query) INTERNAL: Add additional fieldsvoid
preInsert
(WriteObjectQuery query) INTERNAL: Propagate preInsert event to container policy if necessaryprotected void
prepareTranslationRow
(org.eclipse.persistence.internal.sessions.AbstractRecord translationRow, Object object, ClassDescriptor descriptor, org.eclipse.persistence.internal.sessions.AbstractSession session) INTERNAL: copies the non primary key information into the row currently used only in ManyToManyvoid
preUpdate
(WriteObjectQuery query) INTERNAL: Propagate preUpdate event to container policy if necessaryprotected Object
readPrivateOwnedForObject
(ObjectLevelModifyQuery modifyQuery) INTERNAL: All the privately owned parts are readvoid
recordPrivateOwnedRemovals
(Object object, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow) INTERNAL: Overridden by mappings that require additional processing of the change record after the record has been calculated.replaceValueHoldersIn
(Object object, org.eclipse.persistence.internal.sessions.remote.RemoteSessionController controller) INTERNAL: replace the value holders in the specified reference object(s)void
setChangeListener
(Object clone, 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
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
(String sqlString) PUBLIC: Set the receiver's delete all SQL string.protected void
setHasCustomDeleteAllQuery
(boolean bool) void
setListOrderField
(org.eclipse.persistence.internal.helper.DatabaseField field) PUBLIC: Field holds the order of elements in the list in the db, requires collection of type List.void
setListOrderFieldName
(String fieldName) PUBLIC: Field holds the order of elements in the list in the db, requires collection of type List.void
setMustDeleteReferenceObjectsOneByOne
(Boolean deleteOneByOne) ADVANCED:: Return whether the reference objects must be deleted one by one, as opposed to with a single DELETE statement.void
setOrderCorrectionType
(OrderCorrectionType orderCorrectionType) PUBLIC: Specifies what should be done if the list of values read from listOrserField is invalid (there should be no nulls, no duplicates, no "holes").protected void
setSelectionQueryContainerPolicy
(org.eclipse.persistence.internal.queries.ContainerPolicy containerPolicy) INTERNAL: Set the container policy on the selection query for this mapping.void
setSessionName
(String name) PUBLIC: Set the name of the session to execute the mapping's queries under.void
setUseLazyInstantiationForIndirectCollection
(Boolean useLazyInstantiation) ADVANCED: Calling this method will only affect behavior of mappings using transparent indirection This method should only be called after this mapping's indirection policy has been set IndirectList and IndirectSet can be configured not to instantiate the list from the database when you add and remove from them.ADVANCED: This method should only be called after this mapping's indirection policy has been set IndirectList and IndirectSet can be configured not to instantiate the list from the database when you add and remove from them.boolean
INTERNAL: Indicates whether getListOrderFieldExpression method should create field expression based on table expression.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
updateChangeRecord
(Object clone, Object newValue, 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
updateChangeRecordForSelfMerge
(org.eclipse.persistence.internal.sessions.ChangeRecord changeRecord, Object source, Object target, org.eclipse.persistence.internal.sessions.UnitOfWorkChangeSet parentUOWChangeSet, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork) INTERNAL: Update a ChangeRecord to replace the ChangeSet for the old entity with the changeSet for the new Entity.void
updateCollectionChangeRecord
(CollectionChangeEvent event, org.eclipse.persistence.internal.sessions.ObjectChangeSet changeSet, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow) INTERNAL: Add or removes a new value and its change set to the collection change record based on the event passed in.void
useCollectionClass
(Class concreteClass) PUBLIC: Configure the mapping to use an instance of the specified container class to hold the target 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) PUBLIC: Configure the mapping to use an instance of the specified container class to hold the target objects.void
useMapClass
(Class concreteClass, String keyName) PUBLIC: Configure the mapping to use an instance of the specified container class to hold the target objects.void
useMapClassName
(String concreteClassName, String methodName) INTERNAL: Not sure were this is used, MW?void
useSortedSetClass
(Class concreteClass, Comparator comparator) PUBLIC: Configure the mapping to use an instance of the specified container class to hold the target objects.void
useSortedSetClassName
(String className) INTERNAL: Configure the mapping to use an instance of the specified container class name to hold the target objects.void
useSortedSetClassName
(String className, String comparatorClassName) INTERNAL: Configure the mapping to use an instance of the specified container class name to hold the target objects.void
PUBLIC: If transparent indirection is used, a special collection will be placed in the source object's attribute.void
PUBLIC: If transparent indirection is used, a special collection will be placed in the source object's attribute.void
useTransparentMap
(String methodName) PUBLIC: If transparent indirection is used, a special map will be placed in the source object's attribute.void
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 declarationvalueFromPKList
(Object[] pks, org.eclipse.persistence.internal.sessions.AbstractRecord foreignKeys, org.eclipse.persistence.internal.sessions.AbstractSession session) INTERNAL: This method is used to load a relationship from a list of PKs.protected Object
valueFromRowInternalWithJoin
(org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager, ObjectBuildingQuery sourceQuery, org.eclipse.persistence.internal.identitymaps.CacheKey parentCacheKey, org.eclipse.persistence.internal.sessions.AbstractSession executionSession, boolean isTargetProtected) INTERNAL: Return the value of the field from the row or a value holder on the query to obtain the object.boolean
verifyDelete
(Object object, org.eclipse.persistence.internal.sessions.AbstractSession session) INTERNAL: Checks if object is deleted from the database or not.void
writeChanges
(org.eclipse.persistence.internal.sessions.ObjectChangeSet changeSet, WriteObjectQuery query) INTERNAL: Write the changes defined in the change set for the mapping.Methods inherited from class org.eclipse.persistence.mappings.ForeignReferenceMapping
addForeignKeyField, addTargetForeignKeyField, batchedValueFromRow, buildBackupClone, buildBatchCriteria, buildClone, buildCloneFromRow, checkCacheForBatchKey, createCloneValueHolder, dontDoMerge, dontUseBatchReading, dontUseIndirection, extendPessimisticLockScopeInSourceQuery, extendPessimisticLockScopeInTargetQuery, extractBatchKeyFromRow, fixObjectReferences, getAttributeValueFromObject, getAttributeValueWithClonedValueHolders, getBatchFetchType, getExtendPessimisticLockScopeDedicatedQuery, getFieldsForTranslationInAggregate, getIndirectionPolicy, getJoinFetch, getMappedBy, getOrderByNormalizedExpressions, getPartitioningPolicy, getPartitioningPolicyName, getRealAttributeValueFromAttribute, getReferenceClass, getReferenceClassName, getReferenceDescriptor, getRelationshipPartner, getRelationshipPartnerAttributeName, getSelectionCriteria, getSelectionQuery, getTempSession, getValueFromRemoteValueHolder, hasCustomSelectionQuery, hasDependency, hasNestedIdentityReference, initializeReferenceDescriptor, initializeSelectionQuery, instantiateAttribute, isAttributeValueFromObjectInstantiated, isAttributeValueFullyBuilt, isAttributeValueInstantiated, isCascadeDetach, isCascadeMerge, isCascadeOnDeleteSetOnDatabase, isCascadePersist, isCascadeRefresh, isCascadeRemove, isExtendingPessimisticLockScope, isForeignReferenceMapping, isInnerJoinFetched, isJoinFetched, isJoiningSupported, isLazy, isLockableMapping, isOuterJoinFetched, isPrivateOwned, iterate, mergeRemoteValueHolder, preInitialize, prepareHistoricalQuery, prepareNestedBatchQuery, prepareNestedJoinQueryClone, prepareNestedJoins, privateOwnedRelationship, readFromRowIntoObject, remoteInitialization, requiresTransientWeavedFields, setBatchFetchType, setCascadeAll, setCascadeDetach, setCascadeMerge, setCascadePersist, setCascadeRefresh, setCascadeRemove, setCustomSelectionQuery, setForceInitializationOfSelectionCriteria, setHasCustomSelectionQuery, setIndirectionPolicy, setIsCacheable, setIsCascadeOnDeleteSetOnDatabase, setIsPrivateOwned, setJoinFetch, setMappedBy, setPartitioningPolicy, setPartitioningPolicyName, setRealAttributeValueInObject, setReferenceClass, setReferenceClassName, setReferenceDescriptor, setRelationshipPartner, setRelationshipPartnerAttributeName, setRequiresTransientWeavedFields, setSelectionCall, setSelectionCriteria, setSelectionQuery, setSelectionSQLString, setShouldExtendPessimisticLockScope, setTempSession, setUsesBatchReading, setUsesIndirection, shouldExtendPessimisticLockScope, shouldExtendPessimisticLockScopeInDedicatedQuery, shouldExtendPessimisticLockScopeInSourceQuery, shouldExtendPessimisticLockScopeInTargetQuery, shouldForceInitializationOfSelectionCriteria, shouldInitializeSelectionCriteria, shouldMergeCascadeParts, shouldMergeCascadeReference, shouldObjectModifyCascadeToParts, shouldRefreshCascadeParts, shouldUseBatchReading, shouldUseValueFromRowWithJoin, trimRowForJoin, trimRowForJoin, useBasicIndirection, useBatchReading, useContainerIndirection, useInnerJoinFetch, useOuterJoinFetch, usesIndirection, useWeavedIndirection, valueFromRow, valueFromRowInternal, valueFromRowInternal
Methods inherited from class org.eclipse.persistence.mappings.DatabaseMapping
addUnconvertedProperty, buildObjectJoinExpression, buildObjectJoinExpression, buildShallowOriginalFromRow, cloneFields, collectFields, convertConverterClassNamesToClasses, derivesId, earlyPreDelete, extractNestedExpressions, extractNestedNonAggregateExpressions, getAttributeAccessor, getAttributeClassification, getAttributeName, getDerivedIdMapping, getDescriptor, getField, getFieldClassification, getFields, getGetMethodName, getMapsIdValue, getProperties, getProperty, getRealAttributeValueFromObject, getSelectFields, getSelectTables, getSetMethodName, getUnconvertedProperties, getWeight, hasConstraintDependency, hasInverseConstraintDependency, hasMapsIdValue, hasRootExpressionThatShouldUseOuterJoin, hasUnconvertedProperties, isAbstractColumnMapping, isAbstractCompositeCollectionMapping, isAbstractCompositeDirectCollectionMapping, isAbstractCompositeObjectMapping, isAbstractDirectMapping, isAggregateCollectionMapping, isAggregateMapping, isAggregateObjectMapping, isCacheable, isCandidateForPrivateOwnedRemoval, isCascadedLockingSupported, isCloningRequired, isDatabaseMapping, isDirectCollectionMapping, isDirectMapMapping, isDirectToFieldMapping, isDirectToXMLTypeMapping, isEISMapping, isElementCollectionMapping, isInAndOutSopObject, isInOnlySopObject, isInSopObject, isJPAId, isManyToManyMapping, isManyToOneMapping, isMapKeyMapping, isMultitenantPrimaryKeyMapping, isNestedTableMapping, isObjectReferenceMapping, isOneToManyMapping, isOneToOneMapping, isOptional, isOutOnlySopObject, isOutSopObject, isOwned, isPrimaryKeyMapping, isReadOnly, isReferenceMapping, isRelationalMapping, isRemotelyInitialized, isStructureMapping, isTransformationMapping, isUnidirectionalOneToManyMapping, isUsingMethodAccess, isVariableOneToOneMapping, isWriteOnly, isXMLMapping, performDataModificationEvent, postCalculateChangesOnDeleted, postInitializeSourceAndTargetExpressions, postUpdate, preDelete, prepareCascadeLockingPolicy, readFromResultSetIntoObject, readOnly, readWrite, rehashFieldDependancies, remotelyInitialized, setAttributeAccessor, setAttributeName, setAttributeValueInObject, setDerivedIdMapping, setDerivesId, setDescriptor, setFields, setGetMethodName, setIsInAndOutSopObject, setIsInSopObject, setIsJPAId, setIsLazy, setIsMapKeyMapping, setIsOptional, setIsOutSopObject, setIsPrimaryKeyMapping, setIsReadOnly, setMapsIdValue, setProperties, setProperty, setSetMethodName, setWeight, toString, validateAfterInitialization, valueFromObject, valueFromResultSet, valueFromRow, writeFromAttributeIntoRow, writeFromObjectIntoRow, writeFromObjectIntoRowForShallowInsert, writeFromObjectIntoRowForShallowInsertWithChangeRecord, writeFromObjectIntoRowForUpdate, writeFromObjectIntoRowForUpdateAfterShallowInsert, writeFromObjectIntoRowForUpdateBeforeShallowDelete, writeFromObjectIntoRowForWhereClause, writeFromObjectIntoRowWithChangeRecord, writeInsertFieldsIntoRow, writeUpdateFieldsIntoRow
-
Field Details
-
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 boolean hasOrderBy -
listOrderField
protected org.eclipse.persistence.internal.helper.DatabaseField listOrderFieldField holds the order of elements in the list in the db, requires collection of type List, may be not null only in case isListOrderFieldSupported==true -
isListOrderFieldSupported
protected boolean isListOrderFieldSupportedIndicates whether the mapping supports listOrderField, if it doesn't attempt to set listOrderField throws exception. -
changeOrderTargetQuery
Query used when order of list members is changed. Used only if listOrderField!=null -
orderCorrectionType
Specifies what should be done if the list of values read from listOrserField is invalid (there should be no nulls, no duplicates, no "holes"). -
mustDeleteReferenceObjectsOneByOne
Store if the mapping can batch delete reference objects. -
isSynchronizeOnMerge
protected static boolean isSynchronizeOnMergeFlag to indicate if collection needs to be synchronized instead of cloning during merge.
-
-
Constructor Details
-
CollectionMapping
public CollectionMapping()PUBLIC: Default constructor.
-
-
Method Details
-
addAscendingOrdering
PUBLIC: Provide order support for queryKeyName in ascending order -
addDescendingOrdering
PUBLIC: Provide order support for queryKeyName in descending order. -
addOrderBy
PUBLIC: Provide order support for queryKeyName in descending or ascending order. Called from the jpa metadata processing of an order by value. -
addAggregateOrderBy
PUBLIC: Provide order support for queryKeyName in ascending or descending order. Called from the jpa metadata processing of an order by value. The aggregate name may be chained through the dot notation. -
buildBackupCloneForPartObject
public Object buildBackupCloneForPartObject(Object attributeValue, Object clone, 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 classForeignReferenceMapping
-
buildCloneForPartObject
public Object buildCloneForPartObject(Object attributeValue, Object original, org.eclipse.persistence.internal.identitymaps.CacheKey cacheKey, Object clone, org.eclipse.persistence.internal.sessions.AbstractSession cloningSession, Integer refreshCascade, boolean isExisting, boolean isFromSharedCache) INTERNAL: Require for cloning, the part must be cloned. Ignore the objects, use the attribute value.- Specified by:
buildCloneForPartObject
in classForeignReferenceMapping
-
buildContainerClone
public Object buildContainerClone(Object attributeValue, org.eclipse.persistence.internal.sessions.AbstractSession cloningSession) INTERNAL: Performs a first level clone of the attribute. This generally means on the container will be cloned.- Overrides:
buildContainerClone
in classDatabaseMapping
-
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
-
copyElement
INTERNAL: Copies member's value -
buildElementUnitOfWorkClone
public Object buildElementUnitOfWorkClone(Object element, Object parent, Integer refreshCascade, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork, boolean isExisting, boolean isFromSharedCache) INTERNAL: Clone the element, if necessary. -
buildElementClone
public Object buildElementClone(Object element, Object parent, org.eclipse.persistence.internal.identitymaps.CacheKey parentCacheKey, Integer refreshCascade, org.eclipse.persistence.internal.sessions.AbstractSession cloningSession, boolean isExisting, boolean isFromSharedCache) INTERNAL: Clone the element, if necessary. -
buildExpression
public Expression buildExpression(Object queryObject, QueryByExamplePolicy policy, Expression expressionBuilder, Map processedObjects, org.eclipse.persistence.internal.sessions.AbstractSession session) INTERNAL: In case Query By Example is used, this method generates an expression from a attribute value pair. Since this is an Aggregate mapping, a recursive call is made to the buildExpressionFromExample method of ObjectBuilder.- Overrides:
buildExpression
in classDatabaseMapping
-
buildReferencesPKList
public Object[] buildReferencesPKList(Object entity, Object attribute, org.eclipse.persistence.internal.sessions.AbstractSession session) INTERNAL: This method will access the target relationship and create a list of information to rebuild the relationship. This method is used in combination with the CachedValueHolder to store references to PK's to be loaded from a cache instead of a query.- Specified by:
buildReferencesPKList
in classForeignReferenceMapping
-
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
-
cascadePerformRemovePrivateOwnedObjectFromChangeSetIfRequired
public void cascadePerformRemovePrivateOwnedObjectFromChangeSetIfRequired(Object object, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow, Map visitedObjects) INTERNAL: Cascade perform removal of orphaned private owned objects from the UnitOfWorkChangeSet- Overrides:
cascadePerformRemovePrivateOwnedObjectFromChangeSetIfRequired
in classDatabaseMapping
-
cascadeDiscoverAndPersistUnregisteredNewObjects
public void cascadeDiscoverAndPersistUnregisteredNewObjects(Object object, Map newObjects, Map unregisteredExistingObjects, Map visitedObjects, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow, Set cascadeErrors) INTERNAL: Cascade discover and persist new objects during commit.- Overrides:
cascadeDiscoverAndPersistUnregisteredNewObjects
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
-
collectQueryParameters
public void collectQueryParameters(Set<org.eclipse.persistence.internal.helper.DatabaseField> record) INTERNAL: This method is used to store the FK fields that can be cached that correspond to noncacheable mappings the FK field values will be used to re-issue the query when cloning the shared cache entity- Specified by:
collectQueryParameters
in classForeignReferenceMapping
-
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 classDatabaseMapping
-
clone
INTERNAL: The mapping clones itself to create deep copy.- Overrides:
clone
in classForeignReferenceMapping
-
compareCollectionsForChange
public void compareCollectionsForChange(Object oldCollection, 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(Object clone, 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 classDatabaseMapping
- Returns:
- prototype.changeset.ChangeRecord
-
compareObjects
public boolean compareObjects(Object firstObject, Object secondObject, org.eclipse.persistence.internal.sessions.AbstractSession session) INTERNAL: Compare the attributes belonging to this mapping for the objects.- Overrides:
compareObjects
in classForeignReferenceMapping
-
writeChanges
public void writeChanges(org.eclipse.persistence.internal.sessions.ObjectChangeSet changeSet, WriteObjectQuery query) throws DatabaseException, OptimisticLockException INTERNAL: Write the changes defined in the change set for the mapping. Mapping added or removed events are raised to allow the mapping to write the changes as required. -
compareObjectsAndWrite
protected void compareObjectsAndWrite(WriteObjectQuery query) throws DatabaseException, OptimisticLockException INTERNAL: The memory objects are compared and only the changes are written to the database. -
compareListsAndWrite
protected void compareListsAndWrite(List previousList, List currentList, WriteObjectQuery query) throws DatabaseException, OptimisticLockException INTERNAL: Old and new lists are compared and only the changes are written to the database. Currently there's no support for listOrderField in CollectionMapping in case there's no change sets, so this method currently never called (currently only overriding method in AggregateCollectionMapping is called). This method should be implemented to support listOrderField functionality without change sets. -
compareObjectsWithoutPrivateOwned
protected boolean compareObjectsWithoutPrivateOwned(Object firstCollection, Object secondCollection, org.eclipse.persistence.internal.sessions.AbstractSession session) Compare two objects if their parts are not private owned- Specified by:
compareObjectsWithoutPrivateOwned
in classForeignReferenceMapping
-
compareObjectsWithPrivateOwned
protected boolean compareObjectsWithPrivateOwned(Object firstCollection, Object secondCollection, org.eclipse.persistence.internal.sessions.AbstractSession session) Compare two objects if their parts are private owned- Specified by:
compareObjectsWithPrivateOwned
in classForeignReferenceMapping
-
compareLists
protected boolean compareLists(List firstList, List secondList, org.eclipse.persistence.internal.sessions.AbstractSession session, boolean withPrivateOwned) Compare two lists. For equality the order of the elements should be the same. Used only if listOrderField != null -
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.- Overrides:
convertClassNamesToClasses
in classForeignReferenceMapping
- Parameters:
classLoader
-
-
extractResultFromBatchQuery
public Object extractResultFromBatchQuery(ReadQuery batchQuery, org.eclipse.persistence.internal.identitymaps.CacheKey parentCacheKey, org.eclipse.persistence.internal.sessions.AbstractRecord sourceRow, org.eclipse.persistence.internal.sessions.AbstractSession session, ObjectLevelReadQuery originalQuery) throws QueryException INTERNAL: Extract the value from the batch optimized query, this should be supported by most query types.- Overrides:
extractResultFromBatchQuery
in classForeignReferenceMapping
- Throws:
QueryException
-
executeBatchQuery
protected void executeBatchQuery(DatabaseQuery query, org.eclipse.persistence.internal.identitymaps.CacheKey parentCacheKey, Map referenceObjectsByKey, org.eclipse.persistence.internal.sessions.AbstractSession session, org.eclipse.persistence.internal.sessions.AbstractRecord translationRow) 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.- Overrides:
executeBatchQuery
in classForeignReferenceMapping
-
extractKeyFromTargetRow
protected Object extractKeyFromTargetRow(org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.sessions.AbstractSession session) INTERNAL: Extract the source primary key value from the target row. Used for batch reading, most following same order and fields as in the mapping. The method should be overridden by classes that support batch reading. -
fixRealObjectReferences
public void fixRealObjectReferences(Object object, Map objectDescriptors, Map processedObjects, ObjectLevelReadQuery query, DistributedSession 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 classDatabaseMapping
-
getContainerPolicy
public org.eclipse.persistence.internal.queries.ContainerPolicy getContainerPolicy()INTERNAL: Returns the receiver's containerPolicy.- Specified by:
getContainerPolicy
in interfaceContainerMapping
- Overrides:
getContainerPolicy
in classDatabaseMapping
-
getDeleteAllQuery
-
getJoinCriteria
public Expression getJoinCriteria(org.eclipse.persistence.internal.expressions.ObjectExpression context, Expression base) INTERNAL: Returns the join criteria stored in the mapping selection query. This criteria is used to read reference objects across the tables from the database.- Overrides:
getJoinCriteria
in classForeignReferenceMapping
-
getObjectCorrespondingTo
public Object getObjectCorrespondingTo(Object object, DistributedSession session, Map objectDescriptors, 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 classForeignReferenceMapping
-
getOrderByQueryKeyExpressions
INTERNAL: Return the ordering query keys. Used for Workbench integration. -
getSelectionQueryContainerPolicy
protected org.eclipse.persistence.internal.queries.ContainerPolicy getSelectionQueryContainerPolicy()INTERNAL: Get the container policy from the selection query for this mapping. This method is overridden in DirectCollectionMapping since its selection query is a DataReadQuery. -
getRealCollectionAttributeValueFromObject
public Object getRealCollectionAttributeValueFromObject(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 classDatabaseMapping
- Throws:
DescriptorException
-
getListOrderField
public org.eclipse.persistence.internal.helper.DatabaseField getListOrderField()PUBLIC: Field holds the order of elements in the list in the db, requires collection of type List; may be not null only in case isListOrderFieldSupported==true. -
getTargetPrimaryKeyFields
INTERNAL: Returns list of primary key fields from the reference descriptor. -
getOrderCorrectionType
PUBLIC: Specifies what should be done if the list of values read from listOrserField is invalid (there should be no nulls, no duplicates, no "holes"). -
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 classForeignReferenceMapping
- Throws:
DescriptorException
-
initializeListOrderField
protected void initializeListOrderField(org.eclipse.persistence.internal.sessions.AbstractSession session) INTERNAL: Initializes listOrderField. Precondition: listOrderField != null. -
initializeListOrderFieldTable
protected void initializeListOrderFieldTable(org.eclipse.persistence.internal.sessions.AbstractSession session) INTERNAL: Initializes listOrderField's table, does nothing by default. Precondition: listOrderField != null. -
buildListOrderField
protected void buildListOrderField()INTERNAL: Verifies listOrderField's table, if none found sets the default one. Precondition: listOrderField != null. -
shouldUseLazyInstantiationForIndirectCollection
ADVANCED: This method should only be called after this mapping's indirection policy has been set IndirectList and IndirectSet can be configured not to instantiate the list from the database when you add and remove from them. IndirectList defaults to this behavior. When Set to true, the collection associated with this TransparentIndirection will be setup so as not to instantiate for adds and removes. The weakness of this setting for an IndirectSet is that when the set is not instantiated, if a duplicate element is added, it will not be detected until commit time. -
shouldUseListOrderFieldTableExpression
public boolean shouldUseListOrderFieldTableExpression()INTERNAL: Indicates whether getListOrderFieldExpression method should create field expression based on table expression. -
initializeChangeOrderTargetQuery
protected void initializeChangeOrderTargetQuery(org.eclipse.persistence.internal.sessions.AbstractSession session) INTERNAL: Initialize changeOrderTargetQuery. -
isCollectionMapping
public boolean isCollectionMapping()INTERNAL: Return whether this mapping is a Collection type.- Overrides:
isCollectionMapping
in classDatabaseMapping
-
isMapKeyObjectRelationship
public boolean isMapKeyObjectRelationship()INTERNAL: Return if this mapping has a mapped key that uses a OneToOne (object). -
isAttributeValueInstantiatedOrChanged
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, Object element) INTERNAL: Iterate on the specified element. -
iterateOnRealAttributeValue
public void iterateOnRealAttributeValue(org.eclipse.persistence.internal.descriptors.DescriptorIterator iterator, Object realAttributeValue) INTERNAL: Iterate on the attribute value. The value holder has already been processed.- Specified by:
iterateOnRealAttributeValue
in classForeignReferenceMapping
-
load
public void load(Object object, org.eclipse.persistence.internal.queries.AttributeItem item, org.eclipse.persistence.internal.sessions.AbstractSession session, boolean fromFetchGroup) Force instantiation of the load group.- Overrides:
load
in classForeignReferenceMapping
-
loadAll
public void loadAll(Object object, org.eclipse.persistence.internal.sessions.AbstractSession session, org.eclipse.persistence.internal.helper.IdentityHashSet loaded) Force instantiation of all indirections.- Overrides:
loadAll
in classDatabaseMapping
-
mustDeleteReferenceObjectsOneByOne
public boolean mustDeleteReferenceObjectsOneByOne()ADVANCED: Return whether the reference objects must be deleted one by one, as opposed to with a single DELETE statement. -
mergeChangesIntoObject
public void mergeChangesIntoObject(Object target, org.eclipse.persistence.internal.sessions.ChangeRecord chgRecord, 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. Because this is a collection mapping, values are added to or removed from the collection based on the changeset- 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. This merge is only called when a changeSet for the target does not exist or the target is uninitialized- Specified by:
mergeIntoObject
in classDatabaseMapping
-
objectAddedDuringUpdate
protected void objectAddedDuringUpdate(ObjectLevelModifyQuery query, Object objectAdded, org.eclipse.persistence.internal.sessions.ObjectChangeSet changeSet, Map extraData) throws DatabaseException, OptimisticLockException INTERNAL: An object was added to the collection during an update, insert it if private. -
objectOrderChangedDuringUpdate
protected void objectOrderChangedDuringUpdate(WriteObjectQuery query, Object orderChangedObject, int orderIndex) -
objectRemovedDuringUpdate
protected void objectRemovedDuringUpdate(ObjectLevelModifyQuery query, Object objectDeleted, Map extraData) throws DatabaseException, OptimisticLockException INTERNAL: An object was removed to the collection during an update, delete it if private. -
objectUnchangedDuringUpdate
protected void objectUnchangedDuringUpdate(ObjectLevelModifyQuery query, Object object) throws DatabaseException, OptimisticLockException INTERNAL: An object is still in the collection, update it as it may have changed. -
postCalculateChanges
public void postCalculateChanges(ChangeRecord changeRecord, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow) INTERNAL: Overridden by mappings that require additional processing of the change record after the record has been calculated.- Overrides:
postCalculateChanges
in classDatabaseMapping
-
recordPrivateOwnedRemovals
public void recordPrivateOwnedRemovals(Object object, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow) INTERNAL: Overridden by mappings that require additional processing of the change record after the record has been calculated.- Overrides:
recordPrivateOwnedRemovals
in classDatabaseMapping
-
postPrepareNestedBatchQuery
INTERNAL: Add additional fields- Overrides:
postPrepareNestedBatchQuery
in classForeignReferenceMapping
-
getAdditionalFieldsBaseExpression
INTERNAL: Return the base expression to use for adding fields to the query. Normally this is the query's builder, but may be the join table for m-m. -
prepareTranslationRow
protected void prepareTranslationRow(org.eclipse.persistence.internal.sessions.AbstractRecord translationRow, Object object, ClassDescriptor descriptor, org.eclipse.persistence.internal.sessions.AbstractSession session) INTERNAL: copies the non primary key information into the row currently used only in ManyToMany -
postDelete
INTERNAL: A subclass should implement this method if it wants different behavior. Recurse thru the parts to delete the reference objects after the actual object is deleted.- Overrides:
postDelete
in classDatabaseMapping
- Throws:
DatabaseException
-
postInitialize
public void postInitialize(org.eclipse.persistence.internal.sessions.AbstractSession session) INTERNAL: Ensure the container policy is post initialized- Overrides:
postInitialize
in classDatabaseMapping
-
postInsert
INTERNAL: A subclass should implement this method if it wants different behavior. Recurse thru the parts to delete the reference objects after the actual object is deleted.- Overrides:
postInsert
in classDatabaseMapping
- Throws:
DatabaseException
-
preInsert
INTERNAL: Propagate preInsert event to container policy if necessary- Overrides:
preInsert
in classDatabaseMapping
- Throws:
DatabaseException
OptimisticLockException
-
preUpdate
INTERNAL: Propagate preUpdate event to container policy if necessary- Overrides:
preUpdate
in classDatabaseMapping
- Throws:
DatabaseException
-
objectUnchangedDuringUpdate
protected void objectUnchangedDuringUpdate(ObjectLevelModifyQuery query, Object object, Map backupclones, Object key) throws DatabaseException, OptimisticLockException INTERNAL: An object is still in the collection, update it as it may have changed. -
readPrivateOwnedForObject
protected Object readPrivateOwnedForObject(ObjectLevelModifyQuery modifyQuery) throws DatabaseException INTERNAL: All the privately owned parts are read- Throws:
DatabaseException
-
replaceValueHoldersIn
public Map replaceValueHoldersIn(Object object, org.eclipse.persistence.internal.sessions.remote.RemoteSessionController controller) INTERNAL: replace the value holders in the specified reference object(s)- Overrides:
replaceValueHoldersIn
in classForeignReferenceMapping
-
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 interfaceContainerMapping
-
setCustomDeleteAllQuery
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
-
setDeleteAllSQLString
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: 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: 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. -
setUseLazyInstantiationForIndirectCollection
ADVANCED: Calling this method will only affect behavior of mappings using transparent indirection This method should only be called after this mapping's indirection policy has been set IndirectList and IndirectSet can be configured not to instantiate the list from the database when you add and remove from them. IndirectList defaults to this behavior. When Set to true, the collection associated with this TransparentIndirection will be setup so as not to instantiate for adds and removes. The weakness of this setting for an IndirectSet is that when the set is not instantiated, if a duplicate element is added, it will not be detected until commit time. -
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
-
updateChangeRecord
public void updateChangeRecord(Object clone, Object newValue, 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 classDatabaseMapping
-
updateChangeRecordForSelfMerge
public void updateChangeRecordForSelfMerge(org.eclipse.persistence.internal.sessions.ChangeRecord changeRecord, Object source, Object target, org.eclipse.persistence.internal.sessions.UnitOfWorkChangeSet parentUOWChangeSet, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork) INTERNAL: Update a ChangeRecord to replace the ChangeSet for the old entity with the changeSet for the new Entity. This is used when an Entity is merged into itself and the Entity reference new or detached entities.- Specified by:
updateChangeRecordForSelfMerge
in classForeignReferenceMapping
-
updateCollectionChangeRecord
public void updateCollectionChangeRecord(CollectionChangeEvent event, org.eclipse.persistence.internal.sessions.ObjectChangeSet changeSet, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow) 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.- Overrides:
updateCollectionChangeRecord
in classDatabaseMapping
-
setChangeListener
public void setChangeListener(Object clone, 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 classDatabaseMapping
-
isListOrderFieldSupported
public boolean isListOrderFieldSupported()PUBLIC: indicates whether the mapping supports listOrderField, if it doesn't attempt to set listOrderField throws exception. -
setListOrderField
public void setListOrderField(org.eclipse.persistence.internal.helper.DatabaseField field) PUBLIC: Field holds the order of elements in the list in the db, requires collection of type List. Throws exception if the mapping doesn't support listOrderField. -
setListOrderFieldName
PUBLIC: Field holds the order of elements in the list in the db, requires collection of type List. Throws exception if the mapping doesn't support listOrderField. -
setMustDeleteReferenceObjectsOneByOne
ADVANCED:: Return whether the reference objects must be deleted one by one, as opposed to with a single DELETE statement. Note: Calling this method disables an optimization of the delete behavior -
setOrderCorrectionType
PUBLIC: Specifies what should be done if the list of values read from listOrserField is invalid (there should be no nulls, no duplicates, no "holes"). -
useCollectionClass
PUBLIC: Configure the mapping to use an instance of the specified container class to hold the target objects. Note that if listOrderField is used then setListOrderField method should be called before this method.The container class must implement (directly or indirectly) the
java.util.Collection
interface.- Specified by:
useCollectionClass
in interfaceContainerMapping
-
useSortedSetClass
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
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
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
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: 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:
useMapClass
in interfaceContainerMapping
-
useMapClass
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 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
INTERNAL: Not sure were this is used, MW?- Specified by:
useMapClassName
in interfaceContainerMapping
-
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: 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 classForeignReferenceMapping
- Throws:
DescriptorException
-
verifyDelete
public boolean verifyDelete(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 classDatabaseMapping
- Throws:
DatabaseException
-
isChangeTrackingSupported
INTERNAL: Return if this mapping supports change tracking.- Overrides:
isChangeTrackingSupported
in classDatabaseMapping
-
buildChangeRecord
public org.eclipse.persistence.internal.sessions.ChangeRecord buildChangeRecord(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 classDatabaseMapping
-
valueFromPKList
public Object valueFromPKList(Object[] pks, org.eclipse.persistence.internal.sessions.AbstractRecord foreignKeys, org.eclipse.persistence.internal.sessions.AbstractSession session) INTERNAL: This method is used to load a relationship from a list of PKs. This list may be available if the relationship has been cached.- Specified by:
valueFromPKList
in classForeignReferenceMapping
-
valueFromRowInternalWithJoin
protected Object valueFromRowInternalWithJoin(org.eclipse.persistence.internal.sessions.AbstractRecord row, org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager, ObjectBuildingQuery sourceQuery, org.eclipse.persistence.internal.identitymaps.CacheKey parentCacheKey, org.eclipse.persistence.internal.sessions.AbstractSession executionSession, boolean isTargetProtected) 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 classForeignReferenceMapping
- Throws:
DatabaseException
-