Module org.eclipse.persistence.core
Package org.eclipse.persistence.mappings
Class AggregateCollectionMapping
java.lang.Object
org.eclipse.persistence.core.mappings.CoreMapping<AttributeAccessor,AbstractSession,ContainerPolicy,ClassDescriptor,DatabaseField>
org.eclipse.persistence.mappings.DatabaseMapping
org.eclipse.persistence.mappings.ForeignReferenceMapping
org.eclipse.persistence.mappings.CollectionMapping
org.eclipse.persistence.mappings.AggregateCollectionMapping
- All Implemented Interfaces:
Serializable
,Cloneable
,ContainerMapping
,EmbeddableMapping
,MapComponentMapping
,RelationalMapping
public class AggregateCollectionMapping
extends CollectionMapping
implements RelationalMapping, MapComponentMapping, EmbeddableMapping
Purpose: The aggregate collection mapping is used to represent the aggregate relationship between a single source object and a collection of target objects. The target objects cannot exist without the existence of the source object (privately owned) Unlike the normal aggregate mapping, there is a target table being mapped from the target objects. Unlike normal 1:m mapping, there is no 1:1 back reference mapping, as foreign key constraints have been resolved by the aggregation.
- Since:
- TOPLink/Java 3.0
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.persistence.mappings.DatabaseMapping
DatabaseMapping.WriteType
-
Field Summary
Modifier and TypeFieldDescriptionprotected Map
<String, DatabaseField> Map the name of a field in the aggregate collection descriptor to a field in the actual table specified in the mapping.protected static final String
protected DataModifyQuery
List of converters to apply at initialize time to their cloned aggregate mappings.protected DatabaseTable
Default source table that should be used with the default source fields of this mapping.protected Boolean
Indicates whether the mapping (or at least one of its nested mappings, at any nested depth) references an entity.protected boolean
Indicates whether the entire target object is primary key - in that case the object can't be updated in the db, but rather deleted and then re-inserted.protected boolean
indicates whether listOrderField value could be updated in the db.protected static final String
protected static final String
protected Map
<String, Map<String, DatabaseField>> Map the name of an attribute of the reference descriptor mapped with AggregateCollectionMapping to aggregateToSourceFieldNames that should be applied to this mapping.protected static final String
protected DataModifyQuery
protected ClassDescriptor
In RemoteSession case the mapping needs the reference descriptor serialized from the server, but referenceDescriptor attribute defined as transient in the superclass.protected static final String
protected Vector
<DatabaseField> This is a primary key in the source table that is used as foreign key in the target tableprotected Vector
<DatabaseField> This is a key in the target table which is a foreign key in the target table.protected Map
<DatabaseField, DatabaseField> Foreign keys in the target table to the related keys in the source tableprotected DataModifyQuery
These queries used to update listOrderFieldFields inherited from class org.eclipse.persistence.mappings.CollectionMapping
changeOrderTargetQuery, containerPolicy, deleteAllQuery, hasCustomDeleteAllQuery, hasOrderBy, isListOrderFieldSupported, isSynchronizeOnMerge, listOrderField, mustDeleteReferenceObjectsOneByOne, orderCorrectionType
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
addConverter
(Converter converter, String attributeName) Add a converter to be applied to a mapping of the aggregate descriptor.void
addFieldNameTranslation
(String sourceFieldName, String aggregateFieldName) PUBLIC: Maps a field name in the aggregate descriptor to a field name in the source table.void
addFieldTranslation
(DatabaseField sourceField, String aggregateField) PUBLIC: Maps a field name in the aggregate descriptor to a field in the source table.void
PUBLIC: Maps a field name in the aggregate descriptor to a field name in the source table.void
addNestedFieldNameTranslation
(String attributeName, String sourceFieldName, String aggregateFieldName) PUBLIC: Map the name of an attribute of the reference descriptor mapped with AggregateCollectionMapping to aggregateToSourceFieldNames that should be applied to this mapping.void
addNestedFieldNameTranslations
(String attributeName, Map<String, DatabaseField> map) PUBLIC: Map the name of an attribute of the reference descriptor mapped with AggregateCollectionMapping to aggregateToSourceFields that should be applied to this mapping.void
addNestedFieldTranslation
(String attributeName, DatabaseField sourceField, String aggregateFieldName) PUBLIC: Map the name of an attribute of the reference descriptor mapped with AggregateCollectionMapping to aggregateToSourceFieldNames that should be applied to this mapping.void
INTERNAL: In JPA users may specify overrides to apply to a many to many mapping on a shared embeddable descriptor.void
INTERNAL: In JPA users may specify overrides to apply to a unidirectional one to many mapping on a shared embeddable descriptor.void
addTargetForeignKeyField
(DatabaseField targetForeignKey, DatabaseField sourceKey) PUBLIC: Define the target foreign key relationship in the 1-M aggregate collection mapping.void
addTargetForeignKeyFieldName
(String targetForeignKey, String sourceKey) PUBLIC: Define the target foreign key relationship in the 1-M aggregate collection mapping.buildBackupCloneForPartObject
(Object attributeValue, Object clone, Object backup, UnitOfWorkImpl unitOfWork) INTERNAL: Used during building the backup shallow copy to copy the vector without re-registering the target objects.protected Expression
buildBatchCriteria
(ExpressionBuilder builder, ObjectLevelReadQuery query) INTERNAL: Return the selection criteria used to IN batch fetching.buildCloneForPartObject
(Object attributeValue, Object original, CacheKey cacheKey, Object clone, AbstractSession cloningSession, Integer refreshCascade, boolean isExisting, boolean isFromSharedCache) INTERNAL: Require for cloning, the part must be cloned.protected Object
buildElementBackupClone
(Object element, UnitOfWorkImpl unitOfWork) INTERNAL: Clone the aggregate collection, if necessary.buildElementClone
(Object element, Object parent, CacheKey parentCacheKey, Integer refreshCascade, AbstractSession cloningSession, boolean isExisting, boolean isFromSharedCache) INTERNAL: Clone the aggregate collection, if necessary.buildExpression
(Object queryObject, QueryByExamplePolicy policy, Expression expressionBuilder, Map processedObjects, AbstractSession session) INTERNAL: In case Query By Example is used, this method builds and returns an expression that corresponds to a single attribute and it's value.void
cascadeDiscoverAndPersistUnregisteredNewObjects
(Object object, Map newObjects, Map unregisteredExistingObjects, Map visitedObjects, UnitOfWorkImpl uow, Set cascadeErrors) INTERNAL: Cascade discover and persist new objects during commit.void
cascadePerformRemoveIfRequired
(Object object, UnitOfWorkImpl uow, Map visitedObjects) INTERNAL: Cascade registerNew for Create through mappings that require the cascadevoid
cascadePerformRemovePrivateOwnedObjectFromChangeSetIfRequired
(Object object, UnitOfWorkImpl uow, Map visitedObjects) INTERNAL: Cascade perform removal of orphaned private owned objects from the UnitOfWorkChangeSetvoid
cascadeRegisterNewIfRequired
(Object object, 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<DatabaseField> cacheFields) 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 entitycompareForChange
(Object clone, Object backUp, ObjectChangeSet owner, AbstractSession session) INTERNAL: This method is used to create a change record from comparing two aggregate collectionsboolean
compareLists
(List firstList, List secondList, AbstractSession session) INTERNAL: Compare the attributes belonging to this mapping for the objects.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.protected void
compareListsAndWrite_NonUpdatableListOrderField
(List previousList, List currentList, WriteObjectQuery query) INTERNAL: Old and new lists are compared and only the changes are written to the database.protected void
compareListsAndWrite_UpdatableListOrderField
(List previousList, List currentList, WriteObjectQuery query) INTERNAL: Old and new lists are compared and only the changes are written to the database.protected boolean
compareMapCollectionForChange
(Map cloneObjectCollection, Map backUpCollection, AbstractSession session) INTERNAL: Determine if an AggregateCollection that is contained as a map has changed by comparing the values in the clone to the values in the backup.boolean
compareObjects
(Object firstObject, Object secondObject, AbstractSession session) INTERNAL: Compare the attributes belonging to this mapping for the objects.void
convertClassNamesToClasses
(ClassLoader classLoader) INTERNAL: Convert all the class-name-based settings in this mapping to actual class-based settings.protected ChangeRecord
convertToChangeRecord
(Object cloneCollection, Object backupCollection, ObjectChangeSet owner, AbstractSession session) INTERNAL: This method is used to convert the contents of an aggregateCollection into a changeRecordprotected Object
copyElement
(Object original, CopyGroup group) INTERNAL: Copies member's valuecreateMapComponentFromRow
(AbstractRecord dbRow, ObjectBuildingQuery query, CacheKey parentCacheKey, AbstractSession session, boolean isTargetProtected) INTERNAL Called when a DatabaseMapping is used to map the key in a collection.protected void
deleteAll
(DeleteObjectQuery query, AbstractSession session) To delete all the entries matching the selection criteria from the table stored in the referenced descriptorprotected void
executeEvent
(int eventCode, ObjectLevelModifyQuery query) INTERNAL: Execute a descriptor event for the specified event code.protected Object
extractBatchKeyFromRow
(AbstractRecord row, AbstractSession session) INTERNAL: Extract the primary key value from the source row.protected Object
extractKeyFromTargetRow
(AbstractRecord row, AbstractSession session) INTERNAL: Extract the source primary key value from the target row.getAggregateRow
(ObjectLevelModifyQuery query, Object object) INTERNAL: return the aggregate Record with the primary keys from the source table and target tablegetAndPrepareModifyQueryForInsert
(ObjectLevelModifyQuery originalQuery, Object object) INTERNAL: setup the modifyQuery for post insert/update and pre deleteprotected Expression
getDeleteAllCriteria
(AbstractSession session) Delete all criteria is created with target foreign keys and source keys.protected ModifyQuery
Overrides CollectionMappig because this mapping requires a DeleteAllQuery instead of a ModifyQuery.protected InsertObjectQuery
getInsertObjectQuery
(AbstractSession session, ClassDescriptor desc) INTERNAL: Returns a clone of InsertObjectQuery from the ClassDescriptor's DescriptorQueryManager or a new oneINTERNAL: Return the referenceDescriptor.getReferenceDescriptor
(Class<?> theClass, AbstractSession session) INTERNAL: for inheritance purposeINTERNAL: get reference object keysPUBLIC: Return the source key field names associated with the mapping.INTERNAL: Return the source key names associated with the mappingPUBLIC: Return the target foregin key field names associated with the mapping.INTERNAL: Return the target foregin key fields associated with the mappingINTERNAL:boolean
INTERNAL: Indicates whether the mapping (or at least one of its nested mappings, at any nested depth) references an entity.void
initialize
(AbstractSession session) INTERNAL: For aggregate collection mapping the reference descriptor is cloned.void
initializeChildInheritance
(ClassDescriptor parentDescriptor, AbstractSession session, HashMap<DatabaseField, DatabaseField> fieldTranslation, HashMap<DatabaseTable, DatabaseTable> tableTranslation) INTERNAL: For aggregate mapping the reference descriptor is cloned.protected void
initializeDeleteAllQuery
(AbstractSession session) INTERNAL: Initialize delete all query.void
initializeParentInheritance
(ClassDescriptor parentDescriptor, ClassDescriptor childDescriptor, AbstractSession session, HashMap<DatabaseField, DatabaseField> fieldTranslation, HashMap<DatabaseTable, DatabaseTable> tableTranslation) INTERNAL: For aggregate mapping the reference descriptor is cloned.protected void
Initialize and set the descriptor for the referenced class in this mapping.protected void
INTERNAL: Selection criteria is created with target foreign keys and source keys.protected void
INTERNAL: The foreign keys and the primary key names are converted to DatabaseFields and stored.protected void
INTERNAL: The foreign keys and the primary key names are converted to DatabaseFields and stored.protected void
initializeUpdateListOrderQuery
(AbstractSession session, String queryType) boolean
INTERNAL:boolean
INTERNAL: AggregateCollection contents should not be considered for addition to the UnitOfWork private owned objects list for removal.boolean
INTERNAL Return true if this mapping supports cascaded version optimistic locking.boolean
isChangeTrackingSupported
(Project project) INTERNAL: Return if this mapping supports change tracking.boolean
INTERNAL:boolean
INTERNAL: Return if this mapping support joining.boolean
PUBLIC: indicates whether listOrderField value could be updated in the db.boolean
isOwned()
INTERNAL:boolean
INTERNAL:protected boolean
Checks if source key is specified or not.void
iterateOnElement
(DescriptorIterator iterator, Object element) INTERNAL: Iterate on the specified element.void
load
(Object object, AttributeItem item, AbstractSession session, boolean fromFetchGroup) Force instantiation of the load group.void
loadAll
(Object object, AbstractSession session, IdentityHashSet loaded) Force instantiation of all indirections.void
mergeChangesIntoObject
(Object target, ChangeRecord changeRecord, Object source, MergeManager mergeManager, AbstractSession targetSession) INTERNAL: Merge changes from the source to the target object.void
mergeIntoObject
(Object target, boolean isTargetUnInitialized, Object source, MergeManager mergeManager, AbstractSession targetSession) INTERNAL: Merge changes from the source to the target object.protected void
objectAddedDuringUpdate
(ObjectLevelModifyQuery query, Object objectAdded, ObjectChangeSet changeSet, Map extraData) INTERNAL: An object was added to the collection during an update, insert it if private.protected int
objectChangedListOrderDuringUpdate
(WriteObjectQuery query, int iMin, int iMax, int iShift) protected int
objectChangedListOrderDuringUpdate
(WriteObjectQuery query, Object key, int newOrderValue) 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, Object backupClone) protected void
objectUnchangedDuringUpdate
(ObjectLevelModifyQuery query, Object object, Map backupCloneKeyedCache, Object cachedKey) INTERNAL: An object is still in the collection, update it as it may have changed.void
postInitialize
(AbstractSession session) INTERNAL: For aggregate collection mapping the reference descriptor is cloned.void
postInsert
(WriteObjectQuery query) INTERNAL: Insert privately owned partsprotected void
postPrepareNestedBatchQuery
(ReadQuery batchQuery, ObjectLevelReadQuery query) INTERNAL: Allow the mapping the do any further batch preparation.void
postUpdate
(WriteObjectQuery writeQuery) INTERNAL: Update the privately owned partsvoid
preDelete
(DeleteObjectQuery query) INTERNAL: Delete privately owned partsvoid
preInsert
(WriteObjectQuery query) INTERNAL: The message is passed to its reference class descriptor.void
prepareModifyQueryForDelete
(ObjectLevelModifyQuery originalQuery, ObjectLevelModifyQuery modifyQuery, Object wrappedObject, Map extraData) INTERNAL: setup the modifyQuery for pre deletevoid
prepareModifyQueryForUpdate
(ObjectLevelModifyQuery originalQuery, ObjectLevelModifyQuery modifyQuery, Object object) INTERNAL: setup the modifyQuery for update,prepareNestedJoins
(JoinedAttributeManager joinManager, ObjectBuildingQuery baseQuery, AbstractSession session) INTERNAL: Clone and prepare the JoinedAttributeManager nested JoinedAttributeManager.void
remoteInitialization
(DistributedSession session) INTERNAL: Once a descriptor is serialized to the remote session, all its mappings and reference descriptors are traversed.void
PUBLIC: Set a default source table to use with the source fields of this mapping.void
setIsListOrderFieldUpdatable
(boolean isUpdatable) PUBLIC: indicates whether listOrderField value could be updated in the db.protected void
setReferenceDescriptor
(ClassDescriptor aDescriptor) INTERNAL: Set the referenceDescriptor.void
setSourceKeyFieldNames
(Vector fieldNames) PUBLIC: Set the source key field names associated with the mapping.void
setSourceKeyFields
(Vector<DatabaseField> sourceKeyFields) INTERNAL: set all the primary key names associated with this mappingvoid
setTargetForeignKeyFieldNames
(Vector fieldNames) PUBLIC: Set the target foregin key field names associated with the mapping.void
setTargetForeignKeyFields
(Vector<DatabaseField> targetForeignKeyFields) INTERNAL: set the target foregin key fields associated with the mappingprotected void
setTargetForeignKeyToSourceKeys
(Map<DatabaseField, DatabaseField> targetForeignKeyToSourceKeys) protected boolean
Returns true as any process leading to object modification should also affect its privately owned parts Usually used by write, insert, update and delete.void
simpleAddToCollectionChangeRecord
(Object referenceKey, Object changeSetToAdd, ObjectChangeSet changeSet, 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, ObjectChangeSet changeSet, 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.protected static void
translateTablesAndFields
(ClassDescriptor descriptor, HashMap<DatabaseField, DatabaseField> fieldTranslation, HashMap<DatabaseTable, DatabaseTable> tableTranslation) INTERNAL: Called in case fieldTranslation != null Sets new primary keys, tables, appends fieldTranslation to fieldMap so that all fields in mappings, inheritance etc.protected void
updateNestedAggregateMappings
(ClassDescriptor descriptor, AbstractSession session) INTERNAL: Called in case nestedAggregateToSourceFieldNames != null Updates AggregateObjectMappings and AggregateCollectionMappings of the reference descriptor.boolean
verifyDelete
(Object object, AbstractSession session) INTERNAL: Checks if object is deleted from the database or not.protected void
Verifying deletes make sure that all the records privately owned by this mapping are actually removed.Methods inherited from class org.eclipse.persistence.mappings.CollectionMapping
addAggregateOrderBy, addAscendingOrdering, addDescendingOrdering, addOrderBy, buildChangeRecord, buildContainerClone, buildCopy, buildElementUnitOfWorkClone, buildListOrderField, buildReferencesPKList, calculateDeferredChanges, compareCollectionsForChange, compareLists, compareObjectsAndWrite, compareObjectsWithoutPrivateOwned, compareObjectsWithPrivateOwned, executeBatchQuery, extractResultFromBatchQuery, fixRealObjectReferences, getAdditionalFieldsBaseExpression, getContainerPolicy, getJoinCriteria, getListOrderField, getObjectCorrespondingTo, getOrderByQueryKeyExpressions, getOrderCorrectionType, getRealCollectionAttributeValueFromObject, getSelectionQueryContainerPolicy, getTargetPrimaryKeyFields, hasCustomDeleteAllQuery, hasOrderBy, initializeChangeOrderTargetQuery, initializeListOrderField, initializeListOrderFieldTable, isAttributeValueInstantiatedOrChanged, isCollectionMapping, isListOrderFieldSupported, isMapKeyObjectRelationship, iterateOnRealAttributeValue, mustDeleteReferenceObjectsOneByOne, objectOrderChangedDuringUpdate, objectUnchangedDuringUpdate, postCalculateChanges, postDelete, prepareTranslationRow, preUpdate, readPrivateOwnedForObject, recordPrivateOwnedRemovals, replaceValueHoldersIn, setChangeListener, setContainerPolicy, setCustomDeleteAllQuery, setDeleteAllCall, setDeleteAllQuery, setDeleteAllSQLString, setHasCustomDeleteAllQuery, setListOrderField, setListOrderFieldName, setMustDeleteReferenceObjectsOneByOne, setOrderCorrectionType, setSelectionQueryContainerPolicy, setSessionName, setUseLazyInstantiationForIndirectCollection, shouldUseLazyInstantiationForIndirectCollection, shouldUseListOrderFieldTableExpression, updateChangeRecord, updateChangeRecordForSelfMerge, updateCollectionChangeRecord, useCollectionClass, useCollectionClassName, useListClassName, useMapClass, useMapClass, useMapClassName, useSortedSetClass, useSortedSetClassName, useSortedSetClassName, useTransparentCollection, useTransparentList, useTransparentMap, useTransparentSet, validateBeforeInitialization, valueFromPKList, valueFromRowInternalWithJoin, writeChanges
Methods inherited from class org.eclipse.persistence.mappings.ForeignReferenceMapping
addForeignKeyField, batchedValueFromRow, buildBackupClone, buildClone, buildCloneFromRow, checkCacheForBatchKey, createCloneValueHolder, dontDoMerge, dontUseBatchReading, dontUseIndirection, extendPessimisticLockScopeInSourceQuery, extendPessimisticLockScopeInTargetQuery, fixObjectReferences, getAttributeValueFromObject, getAttributeValueWithClonedValueHolders, getBatchFetchType, getExtendPessimisticLockScopeDedicatedQuery, getFieldsForTranslationInAggregate, getIndirectionPolicy, getJoinFetch, getMappedBy, getOrderByNormalizedExpressions, getPartitioningPolicy, getPartitioningPolicyName, getRealAttributeValueFromAttribute, getReferenceClass, getReferenceClassName, getRelationshipPartner, getRelationshipPartnerAttributeName, getSelectionCriteria, getSelectionQuery, getTempSession, getValueFromRemoteValueHolder, hasCustomSelectionQuery, hasDependency, initializeSelectionQuery, instantiateAttribute, isAttributeValueFromObjectInstantiated, isAttributeValueFullyBuilt, isAttributeValueInstantiated, isCascadeDetach, isCascadeMerge, isCascadeOnDeleteSetOnDatabase, isCascadePersist, isCascadeRefresh, isCascadeRemove, isExtendingPessimisticLockScope, isForeignReferenceMapping, isInnerJoinFetched, isJoinFetched, isLazy, isLockableMapping, isOuterJoinFetched, isPrivateOwned, iterate, mergeRemoteValueHolder, preInitialize, prepareHistoricalQuery, prepareNestedBatchQuery, prepareNestedJoinQueryClone, privateOwnedRelationship, readFromRowIntoObject, requiresTransientWeavedFields, setBatchFetchType, setCascadeAll, setCascadeDetach, setCascadeMerge, setCascadePersist, setCascadeRefresh, setCascadeRemove, setCustomSelectionQuery, setForceInitializationOfSelectionCriteria, setHasCustomSelectionQuery, setIndirectionPolicy, setIsCacheable, setIsCascadeOnDeleteSetOnDatabase, setIsPrivateOwned, setJoinFetch, setMappedBy, setPartitioningPolicy, setPartitioningPolicyName, setRealAttributeValueInObject, setReferenceClass, setReferenceClassName, setRelationshipPartner, setRelationshipPartnerAttributeName, setRequiresTransientWeavedFields, setSelectionCall, setSelectionCriteria, setSelectionQuery, setSelectionSQLString, setShouldExtendPessimisticLockScope, setTempSession, setUsesBatchReading, setUsesIndirection, shouldExtendPessimisticLockScope, shouldExtendPessimisticLockScopeInDedicatedQuery, shouldExtendPessimisticLockScopeInSourceQuery, shouldExtendPessimisticLockScopeInTargetQuery, shouldForceInitializationOfSelectionCriteria, shouldInitializeSelectionCriteria, shouldMergeCascadeParts, shouldMergeCascadeReference, 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, isAggregateMapping, isAggregateObjectMapping, isCacheable, isCloningRequired, isDatabaseMapping, isDirectCollectionMapping, isDirectMapMapping, isDirectToFieldMapping, isDirectToXMLTypeMapping, isEISMapping, isInAndOutSopObject, isInOnlySopObject, isInSopObject, isJPAId, isManyToManyMapping, isManyToOneMapping, isMapKeyMapping, isMultitenantPrimaryKeyMapping, isNestedTableMapping, isObjectReferenceMapping, isOneToManyMapping, isOneToOneMapping, isOptional, isOutOnlySopObject, isOutSopObject, isPrimaryKeyMapping, isReadOnly, isReferenceMapping, isRemotelyInitialized, isStructureMapping, isTransformationMapping, isUnidirectionalOneToManyMapping, isUsingMethodAccess, isVariableOneToOneMapping, isWriteOnly, isXMLMapping, performDataModificationEvent, postCalculateChangesOnDeleted, postInitializeSourceAndTargetExpressions, 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
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.persistence.mappings.EmbeddableMapping
getAttributeName
-
Field Details
-
targetForeignKeyFields
This is a key in the target table which is a foreign key in the target table. -
sourceKeyFields
This is a primary key in the source table that is used as foreign key in the target table -
targetForeignKeyToSourceKeys
Foreign keys in the target table to the related keys in the source table -
aggregateToSourceFields
Map the name of a field in the aggregate collection descriptor to a field in the actual table specified in the mapping. -
nestedAggregateToSourceFields
Map the name of an attribute of the reference descriptor mapped with AggregateCollectionMapping to aggregateToSourceFieldNames that should be applied to this mapping. -
converters
List of converters to apply at initialize time to their cloned aggregate mappings. -
remoteReferenceDescriptor
In RemoteSession case the mapping needs the reference descriptor serialized from the server, but referenceDescriptor attribute defined as transient in the superclass. To overcome that in non-remote case referenceDescriptor is assigned to remoteReferenceDescriptor; in remote - another way around. -
defaultSourceTable
Default source table that should be used with the default source fields of this mapping. -
isEntireObjectPK
protected boolean isEntireObjectPKIndicates whether the entire target object is primary key - in that case the object can't be updated in the db, but rather deleted and then re-inserted. -
updateListOrderFieldQuery
These queries used to update listOrderField -
bulkUpdateListOrderFieldQuery
-
pkUpdateListOrderFieldQuery
-
isListOrderFieldUpdatable
protected boolean isListOrderFieldUpdatableindicates whether listOrderField value could be updated in the db. Used only if listOrderField!=null -
min
- See Also:
-
max
- See Also:
-
shift
- See Also:
-
pk
- See Also:
-
bulk
- See Also:
-
hasNestedIdentityReference
Indicates whether the mapping (or at least one of its nested mappings, at any nested depth) references an entity. To return true the mapping (or nested mapping) should be ForeignReferenceMapping with non-null and non-aggregate reference descriptor. Lazily initialized.
-
-
Constructor Details
-
AggregateCollectionMapping
public AggregateCollectionMapping()PUBLIC: Default constructor.
-
-
Method Details
-
isRelationalMapping
public boolean isRelationalMapping()INTERNAL:- Overrides:
isRelationalMapping
in classDatabaseMapping
-
addOverrideManyToManyMapping
INTERNAL: In JPA users may specify overrides to apply to a many to many mapping on a shared embeddable descriptor. These settings are applied at initialize time, after the reference descriptor is cloned. In an aggregate collection case, this is not supported and currently silently ignored and does nothing.- Specified by:
addOverrideManyToManyMapping
in interfaceEmbeddableMapping
-
addOverrideUnidirectionalOneToManyMapping
INTERNAL: In JPA users may specify overrides to apply to a unidirectional one to many mapping on a shared embeddable descriptor. These settings are applied at initialize time, after the reference descriptor is cloned. In an aggregate collection case, this is not supported and currently silently ignored and does nothing.- Specified by:
addOverrideUnidirectionalOneToManyMapping
in interfaceEmbeddableMapping
-
addConverter
Add a converter to be applied to a mapping of the aggregate descriptor.- Specified by:
addConverter
in interfaceEmbeddableMapping
-
addFieldNameTranslation
PUBLIC: Maps a field name in the aggregate descriptor to a field name in the source table. -
addFieldTranslation
PUBLIC: Maps a field name in the aggregate descriptor to a field in the source table.- Specified by:
addFieldTranslation
in interfaceEmbeddableMapping
-
addFieldTranslations
PUBLIC: Maps a field name in the aggregate descriptor to a field name in the source table. -
addNestedFieldNameTranslation
public void addNestedFieldNameTranslation(String attributeName, String sourceFieldName, String aggregateFieldName) PUBLIC: Map the name of an attribute of the reference descriptor mapped with AggregateCollectionMapping to aggregateToSourceFieldNames that should be applied to this mapping. -
addNestedFieldTranslation
public void addNestedFieldTranslation(String attributeName, DatabaseField sourceField, String aggregateFieldName) PUBLIC: Map the name of an attribute of the reference descriptor mapped with AggregateCollectionMapping to aggregateToSourceFieldNames that should be applied to this mapping.- Specified by:
addNestedFieldTranslation
in interfaceEmbeddableMapping
-
addNestedFieldNameTranslations
PUBLIC: Map the name of an attribute of the reference descriptor mapped with AggregateCollectionMapping to aggregateToSourceFields that should be applied to this mapping. -
addTargetForeignKeyField
PUBLIC: Define the target foreign key relationship in the 1-M aggregate collection mapping. Both the target foreign key field and the source primary key field must be specified.- Overrides:
addTargetForeignKeyField
in classForeignReferenceMapping
-
addTargetForeignKeyFieldName
PUBLIC: Define the target foreign key relationship in the 1-M aggregate collection mapping. Both the target foreign key field name and the source primary key field name must be specified. -
buildBackupCloneForPartObject
public Object buildBackupCloneForPartObject(Object attributeValue, Object clone, Object backup, UnitOfWorkImpl unitOfWork) INTERNAL: Used during building the backup shallow copy to copy the vector without re-registering the target objects.- Overrides:
buildBackupCloneForPartObject
in classCollectionMapping
- Parameters:
attributeValue
- TODOclone
- TODObackup
- TODOunitOfWork
- TODO- Returns:
- TODO
-
buildCloneForPartObject
public Object buildCloneForPartObject(Object attributeValue, Object original, CacheKey cacheKey, Object clone, AbstractSession cloningSession, Integer refreshCascade, boolean isExisting, boolean isFromSharedCache) INTERNAL: Require for cloning, the part must be cloned. Ignore the objects, use the attribute value. this is identical to the super class except that the element must be added to the new aggregates collection so that the referenced objects will be cloned correctly- Overrides:
buildCloneForPartObject
in classCollectionMapping
- Parameters:
attributeValue
- TODOoriginal
- TODOcacheKey
- TODOclone
- TODOcloningSession
- TODOrefreshCascade
- TODOisExisting
- TODOisFromSharedCache
- TODO- Returns:
- TODO
-
buildElementBackupClone
INTERNAL: Clone the aggregate collection, if necessary. -
buildElementClone
public Object buildElementClone(Object element, Object parent, CacheKey parentCacheKey, Integer refreshCascade, AbstractSession cloningSession, boolean isExisting, boolean isFromSharedCache) INTERNAL: Clone the aggregate collection, if necessary.- Overrides:
buildElementClone
in classCollectionMapping
-
buildExpression
public Expression buildExpression(Object queryObject, QueryByExamplePolicy policy, Expression expressionBuilder, Map processedObjects, AbstractSession session) INTERNAL: In case Query By Example is used, this method builds and returns an expression that corresponds to a single attribute and it's value.- Overrides:
buildExpression
in classCollectionMapping
- Parameters:
queryObject
- TODOpolicy
- TODOexpressionBuilder
- TODOprocessedObjects
- TODOsession
- TODO- Returns:
- TODO
-
collectQueryParameters
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- Overrides:
collectQueryParameters
in classCollectionMapping
- Parameters:
cacheFields
- TODO
-
convertClassNamesToClasses
INTERNAL: Convert all the class-name-based settings in this mapping to actual class-based settings. This method is used when converting a project that has been built with class names to a project with classes.- Overrides:
convertClassNamesToClasses
in classCollectionMapping
- Parameters:
classLoader
- Where to search for classes.
-
cascadeDiscoverAndPersistUnregisteredNewObjects
public void cascadeDiscoverAndPersistUnregisteredNewObjects(Object object, Map newObjects, Map unregisteredExistingObjects, Map visitedObjects, UnitOfWorkImpl uow, Set cascadeErrors) INTERNAL: Cascade discover and persist new objects during commit.- Overrides:
cascadeDiscoverAndPersistUnregisteredNewObjects
in classCollectionMapping
- Parameters:
object
- TODOnewObjects
- TODOunregisteredExistingObjects
- TODOvisitedObjects
- TODOuow
- TODOcascadeErrors
- TODO
-
cascadeRegisterNewIfRequired
INTERNAL: Cascade registerNew for Create through mappings that require the cascade- Overrides:
cascadeRegisterNewIfRequired
in classCollectionMapping
- Parameters:
object
- TODOuow
- TODOvisitedObjects
- TODO
-
cascadePerformRemoveIfRequired
INTERNAL: Cascade registerNew for Create through mappings that require the cascade- Overrides:
cascadePerformRemoveIfRequired
in classCollectionMapping
- Parameters:
object
- TODOuow
- TODOvisitedObjects
- TODO
-
cascadePerformRemovePrivateOwnedObjectFromChangeSetIfRequired
public void cascadePerformRemovePrivateOwnedObjectFromChangeSetIfRequired(Object object, UnitOfWorkImpl uow, Map visitedObjects) INTERNAL: Cascade perform removal of orphaned private owned objects from the UnitOfWorkChangeSet- Overrides:
cascadePerformRemovePrivateOwnedObjectFromChangeSetIfRequired
in classCollectionMapping
- Parameters:
object
- TODOuow
- TODOvisitedObjects
- TODO
-
clone
INTERNAL: The mapping clones itself to create deep copy.- Specified by:
clone
in interfaceMapComponentMapping
- Overrides:
clone
in classCollectionMapping
- Returns:
- new instance of itself
-
compareForChange
public ChangeRecord compareForChange(Object clone, Object backUp, ObjectChangeSet owner, AbstractSession session) INTERNAL: This method is used to create a change record from comparing two aggregate collections- Overrides:
compareForChange
in classCollectionMapping
- Parameters:
clone
- TODObackUp
- TODOowner
- TODOsession
- TODO- Returns:
- ChangeRecord
-
compareMapCollectionForChange
protected boolean compareMapCollectionForChange(Map cloneObjectCollection, Map backUpCollection, AbstractSession session) INTERNAL: Determine if an AggregateCollection that is contained as a map has changed by comparing the values in the clone to the values in the backup. -
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. Called only if listOrderField != null- Overrides:
compareListsAndWrite
in classCollectionMapping
- Throws:
DatabaseException
OptimisticLockException
-
compareListsAndWrite_NonUpdatableListOrderField
protected void compareListsAndWrite_NonUpdatableListOrderField(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. Called only if listOrderField != null -
compareListsAndWrite_UpdatableListOrderField
protected void compareListsAndWrite_UpdatableListOrderField(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. Called only if listOrderField != null -
objectChangedListOrderDuringUpdate
protected int objectChangedListOrderDuringUpdate(WriteObjectQuery query, int iMin, int iMax, int iShift) -
objectChangedListOrderDuringUpdate
protected int objectChangedListOrderDuringUpdate(WriteObjectQuery query, Object key, int newOrderValue) -
compareObjects
INTERNAL: Compare the attributes belonging to this mapping for the objects.- Overrides:
compareObjects
in classCollectionMapping
- Parameters:
firstObject
- TODOsecondObject
- TODOsession
- TODO- Returns:
- TODO
-
compareLists
INTERNAL: Compare the attributes belonging to this mapping for the objects. -
convertToChangeRecord
protected ChangeRecord convertToChangeRecord(Object cloneCollection, Object backupCollection, ObjectChangeSet owner, AbstractSession session) INTERNAL: This method is used to convert the contents of an aggregateCollection into a changeRecord- Parameters:
cloneCollection
- Object the collection to convertowner
- org.eclipse.persistence.internal.sessions.ObjectChangeSet the ChangeSet that uses this recordsession
- org.eclipse.persistence.internal.sessions.AbstractSession- Returns:
- org.eclipse.persistence.internal.sessions.AggregateCollectionChangeRecord the changerecord representing this AggregateCollectionMapping
-
copyElement
INTERNAL: Copies member's value- Overrides:
copyElement
in classCollectionMapping
-
createMapComponentFromRow
public Object createMapComponentFromRow(AbstractRecord dbRow, ObjectBuildingQuery query, CacheKey parentCacheKey, AbstractSession session, boolean isTargetProtected) INTERNAL Called when a DatabaseMapping is used to map the key in a collection. Returns the key.- Specified by:
createMapComponentFromRow
in interfaceMapComponentMapping
-
deleteAll
To delete all the entries matching the selection criteria from the table stored in the referenced descriptor- Throws:
DatabaseException
-
executeEvent
INTERNAL: Execute a descriptor event for the specified event code. -
extractKeyFromTargetRow
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.- Overrides:
extractKeyFromTargetRow
in classCollectionMapping
-
extractBatchKeyFromRow
INTERNAL: Extract the primary key value from the source row. Used for batch reading, most following same order and fields as in the mapping.- Overrides:
extractBatchKeyFromRow
in classForeignReferenceMapping
-
buildBatchCriteria
INTERNAL: Return the selection criteria used to IN batch fetching.- Overrides:
buildBatchCriteria
in classForeignReferenceMapping
-
postPrepareNestedBatchQuery
INTERNAL: Allow the mapping the do any further batch preparation.- Overrides:
postPrepareNestedBatchQuery
in classCollectionMapping
-
getAggregateRow
INTERNAL: return the aggregate Record with the primary keys from the source table and target table -
getDeleteAllCriteria
Delete all criteria is created with target foreign keys and source keys. This criteria is then used to delete target records from the table. -
getDeleteAllQuery
Overrides CollectionMappig because this mapping requires a DeleteAllQuery instead of a ModifyQuery.- Overrides:
getDeleteAllQuery
in classCollectionMapping
-
getReferenceDescriptor
INTERNAL: Return the referenceDescriptor. This is a descriptor which is associated with the reference class. NOTE: If you are looking for the descriptor for a specific aggregate object, use #getReferenceDescriptor(Object). This will ensure you get the right descriptor if the object's descriptor is part of an inheritance tree.- Overrides:
getReferenceDescriptor
in classForeignReferenceMapping
- Returns:
- TODO
-
getReferenceDescriptor
INTERNAL: for inheritance purpose -
getReferenceObjectKeys
public Vector getReferenceObjectKeys(ObjectLevelModifyQuery query) throws DatabaseException, OptimisticLockException INTERNAL: get reference object keys -
getSourceKeyFieldNames
PUBLIC: Return the source key field names associated with the mapping. These are in-order with the targetForeignKeyFieldNames. -
getSourceKeyFields
INTERNAL: Return the source key names associated with the mapping -
getTargetForeignKeyFieldNames
PUBLIC: Return the target foregin key field names associated with the mapping. These are in-order with the sourceKeyFieldNames. -
getTargetForeignKeyFields
INTERNAL: Return the target foregin key fields associated with the mapping -
getTargetForeignKeyToSourceKeys
INTERNAL: -
initialize
INTERNAL: For aggregate collection mapping the reference descriptor is cloned. The cloned descriptor is then assigned primary keys and table names before initialize. Once cloned descriptor is initialized it is assigned as reference descriptor in the aggregate mapping. This is very specific behavior for aggregate mappings. The original descriptor is used only for creating clones and after that mapping never uses it. Some initialization is done in postInitialize to ensure the target descriptor's references are initialized.- Overrides:
initialize
in classCollectionMapping
- Throws:
DescriptorException
-
initializeReferenceDescriptor
Initialize and set the descriptor for the referenced class in this mapping.- Overrides:
initializeReferenceDescriptor
in classForeignReferenceMapping
- Throws:
DescriptorException
-
initializeUpdateListOrderQuery
-
prepareNestedJoins
public ObjectLevelReadQuery prepareNestedJoins(JoinedAttributeManager joinManager, ObjectBuildingQuery baseQuery, AbstractSession session) INTERNAL: Clone and prepare the JoinedAttributeManager nested JoinedAttributeManager. This is used for nested joining as the JoinedAttributeManager passed to the joined build object.- Overrides:
prepareNestedJoins
in classForeignReferenceMapping
-
translateTablesAndFields
protected static void translateTablesAndFields(ClassDescriptor descriptor, HashMap<DatabaseField, DatabaseField> fieldTranslation, HashMap<DatabaseTable, DatabaseTable> tableTranslation) INTERNAL: Called in case fieldTranslation != null Sets new primary keys, tables, appends fieldTranslation to fieldMap so that all fields in mappings, inheritance etc. translated to the new ones. -
updateNestedAggregateMappings
INTERNAL: Called in case nestedAggregateToSourceFieldNames != null Updates AggregateObjectMappings and AggregateCollectionMappings of the reference descriptor. -
initializeChildInheritance
public void initializeChildInheritance(ClassDescriptor parentDescriptor, AbstractSession session, HashMap<DatabaseField, DatabaseField> fieldTranslation, HashMap<DatabaseTable, throws DescriptorExceptionDatabaseTable> tableTranslation) INTERNAL: For aggregate mapping the reference descriptor is cloned. Also the involved inheritance descriptor, its children and parents all need to be cloned. The cloned descriptors are then assigned primary keys and table names before initialize. Once cloned descriptor is initialized it is assigned as reference descriptor in the aggregate mapping. This is very specific behavior for aggregate mappings. The original descriptor is used only for creating clones and after that mapping never uses it. Some initialization is done in postInitialize to ensure the target descriptor's references are initialized.- Throws:
DescriptorException
-
initializeDeleteAllQuery
INTERNAL: Initialize delete all query. This query is used to delete the collection of objects from the target table. -
initializeParentInheritance
public void initializeParentInheritance(ClassDescriptor parentDescriptor, ClassDescriptor childDescriptor, AbstractSession session, HashMap<DatabaseField, DatabaseField> fieldTranslation, HashMap<DatabaseTable, throws DescriptorExceptionDatabaseTable> tableTranslation) INTERNAL: For aggregate mapping the reference descriptor is cloned. Also the involved inheritance descriptor, its children and parents all need to be cloned. The cloned descriptors are then assigned primary keys and table names before initialize. Once cloned descriptor is initialized it is assigned as reference descriptor in the aggregate mapping. This is very specific behavior for aggregate mappings. The original descriptor is used only for creating clones and after that mapping never uses it. Some initialization is done in postInitialize to ensure the target descriptor's references are initialized.- Throws:
DescriptorException
-
initializeSelectionCriteria
INTERNAL: Selection criteria is created with target foreign keys and source keys. This criteria is then used to read records from the target table. -
initializeTargetForeignKeyToSourceKeys
protected void initializeTargetForeignKeyToSourceKeys(AbstractSession session) throws DescriptorException INTERNAL: The foreign keys and the primary key names are converted to DatabaseFields and stored.- Throws:
DescriptorException
-
initializeTargetForeignKeyToSourceKeysWithDefaults
protected void initializeTargetForeignKeyToSourceKeysWithDefaults(AbstractSession session) throws DescriptorException INTERNAL: The foreign keys and the primary key names are converted to DatabaseFields and stored. The source keys are not specified by the user so primary keys are extracted from the reference descriptor.- Throws:
DescriptorException
-
iterateOnElement
INTERNAL: Iterate on the specified element.- Overrides:
iterateOnElement
in classCollectionMapping
-
isAggregateCollectionMapping
public boolean isAggregateCollectionMapping()INTERNAL:- Overrides:
isAggregateCollectionMapping
in classDatabaseMapping
-
isElementCollectionMapping
public boolean isElementCollectionMapping()INTERNAL:- Overrides:
isElementCollectionMapping
in classDatabaseMapping
-
isJoiningSupported
public boolean isJoiningSupported()INTERNAL: Return if this mapping support joining.- Overrides:
isJoiningSupported
in classForeignReferenceMapping
-
isOwned
public boolean isOwned()INTERNAL:- Overrides:
isOwned
in classDatabaseMapping
-
isSourceKeySpecified
protected boolean isSourceKeySpecified()Checks if source key is specified or not. -
load
public void load(Object object, AttributeItem item, AbstractSession session, boolean fromFetchGroup) Force instantiation of the load group.- Overrides:
load
in classCollectionMapping
-
loadAll
Force instantiation of all indirections.- Overrides:
loadAll
in classCollectionMapping
-
mergeChangesIntoObject
public void mergeChangesIntoObject(Object target, ChangeRecord changeRecord, Object source, MergeManager mergeManager, 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- Overrides:
mergeChangesIntoObject
in classCollectionMapping
-
mergeIntoObject
public void mergeIntoObject(Object target, boolean isTargetUnInitialized, Object source, MergeManager mergeManager, AbstractSession targetSession) INTERNAL: Merge changes from the source to the target object.- Overrides:
mergeIntoObject
in classCollectionMapping
-
objectAddedDuringUpdate
protected void objectAddedDuringUpdate(ObjectLevelModifyQuery query, Object objectAdded, ObjectChangeSet changeSet, Map extraData) throws DatabaseException, OptimisticLockException INTERNAL: An object was added to the collection during an update, insert it if private.- Overrides:
objectAddedDuringUpdate
in classCollectionMapping
- Throws:
DatabaseException
OptimisticLockException
-
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.- Overrides:
objectRemovedDuringUpdate
in classCollectionMapping
- Throws:
DatabaseException
OptimisticLockException
-
objectUnchangedDuringUpdate
protected void objectUnchangedDuringUpdate(ObjectLevelModifyQuery query, Object object, Map backupCloneKeyedCache, Object cachedKey) throws DatabaseException, OptimisticLockException INTERNAL: An object is still in the collection, update it as it may have changed.- Overrides:
objectUnchangedDuringUpdate
in classCollectionMapping
- Throws:
DatabaseException
OptimisticLockException
-
objectUnchangedDuringUpdate
protected void objectUnchangedDuringUpdate(ObjectLevelModifyQuery query, Object object, Object backupClone) throws DatabaseException, OptimisticLockException -
postInitialize
INTERNAL: For aggregate collection mapping the reference descriptor is cloned. The cloned descriptor is then assigned primary keys and table names before initialize. Once the cloned descriptor is initialized it is assigned as reference descriptor in the aggregate mapping. This is a very specific behavior for aggregate mappings. The original descriptor is used only for creating clones and after that the aggregate mapping never uses it. Some initialization is done in postInitialize to ensure the target descriptor's references are initialized.- Overrides:
postInitialize
in classCollectionMapping
- Throws:
DescriptorException
-
postInsert
INTERNAL: Insert privately owned parts- Overrides:
postInsert
in classCollectionMapping
- Throws:
DatabaseException
OptimisticLockException
-
postUpdate
public void postUpdate(WriteObjectQuery writeQuery) throws DatabaseException, OptimisticLockException INTERNAL: Update the privately owned parts- Overrides:
postUpdate
in classDatabaseMapping
- Throws:
DatabaseException
OptimisticLockException
-
preDelete
INTERNAL: Delete privately owned parts- Overrides:
preDelete
in classDatabaseMapping
- Throws:
DatabaseException
OptimisticLockException
-
preInsert
INTERNAL: The message is passed to its reference class descriptor.- Overrides:
preInsert
in classCollectionMapping
- Throws:
DatabaseException
OptimisticLockException
-
getInsertObjectQuery
INTERNAL: Returns a clone of InsertObjectQuery from the ClassDescriptor's DescriptorQueryManager or a new one -
getAndPrepareModifyQueryForInsert
public InsertObjectQuery getAndPrepareModifyQueryForInsert(ObjectLevelModifyQuery originalQuery, Object object) INTERNAL: setup the modifyQuery for post insert/update and pre delete -
prepareModifyQueryForDelete
public void prepareModifyQueryForDelete(ObjectLevelModifyQuery originalQuery, ObjectLevelModifyQuery modifyQuery, Object wrappedObject, Map extraData) INTERNAL: setup the modifyQuery for pre delete -
prepareModifyQueryForUpdate
public void prepareModifyQueryForUpdate(ObjectLevelModifyQuery originalQuery, ObjectLevelModifyQuery modifyQuery, Object object) INTERNAL: setup the modifyQuery for update, -
setReferenceDescriptor
INTERNAL: Set the referenceDescriptor. This is a descriptor which is associated with the reference class.- Overrides:
setReferenceDescriptor
in classForeignReferenceMapping
-
setSourceKeyFieldNames
PUBLIC: Set the source key field names associated with the mapping. These must be in-order with the targetForeignKeyFieldNames. -
setSourceKeyFields
INTERNAL: set all the primary key names associated with this mapping -
setTargetForeignKeyFieldNames
PUBLIC: Set the target foregin key field names associated with the mapping. These must be in-order with the sourceKeyFieldNames. -
setTargetForeignKeyFields
INTERNAL: set the target foregin key fields associated with the mapping -
setTargetForeignKeyToSourceKeys
protected void setTargetForeignKeyToSourceKeys(Map<DatabaseField, DatabaseField> targetForeignKeyToSourceKeys) -
shouldObjectModifyCascadeToParts
Returns true as any process leading to object modification should also affect its privately owned parts Usually used by write, insert, update and delete.- Overrides:
shouldObjectModifyCascadeToParts
in classForeignReferenceMapping
-
simpleAddToCollectionChangeRecord
public void simpleAddToCollectionChangeRecord(Object referenceKey, Object changeSetToAdd, ObjectChangeSet changeSet, 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. PLEASE ENSURE that the changes have been made in the object model first.- Overrides:
simpleAddToCollectionChangeRecord
in classCollectionMapping
-
simpleRemoveFromCollectionChangeRecord
public void simpleRemoveFromCollectionChangeRecord(Object referenceKey, Object changeSetToRemove, ObjectChangeSet changeSet, 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. PLEASE ENSURE that the changes have been made in the object model first.- Overrides:
simpleRemoveFromCollectionChangeRecord
in classCollectionMapping
-
verifyDelete
INTERNAL: Checks if object is deleted from the database or not.- Overrides:
verifyDelete
in classCollectionMapping
- Throws:
DatabaseException
-
verifyDeleteForUpdate
protected void verifyDeleteForUpdate(DeleteObjectQuery query) throws DatabaseException, OptimisticLockException Verifying deletes make sure that all the records privately owned by this mapping are actually removed. If such records are found than those are all read and removed one by one taking their privately owned parts into account. -
isCandidateForPrivateOwnedRemoval
public boolean isCandidateForPrivateOwnedRemoval()INTERNAL: AggregateCollection contents should not be considered for addition to the UnitOfWork private owned objects list for removal.- Overrides:
isCandidateForPrivateOwnedRemoval
in classDatabaseMapping
-
isCascadedLockingSupported
public boolean isCascadedLockingSupported()INTERNAL Return true if this mapping supports cascaded version optimistic locking.- Overrides:
isCascadedLockingSupported
in classDatabaseMapping
-
isChangeTrackingSupported
INTERNAL: Return if this mapping supports change tracking.- Overrides:
isChangeTrackingSupported
in classCollectionMapping
-
remoteInitialization
INTERNAL: Once a descriptor is serialized to the remote session, all its mappings and reference descriptors are traversed. Usually the mappings are initialized and the serialized reference descriptors are replaced with local descriptors if they already exist in the remote session.- Overrides:
remoteInitialization
in classForeignReferenceMapping
-
isListOrderFieldUpdatable
public boolean isListOrderFieldUpdatable()PUBLIC: indicates whether listOrderField value could be updated in the db. Used only if listOrderField!=null -
setIsListOrderFieldUpdatable
public void setIsListOrderFieldUpdatable(boolean isUpdatable) PUBLIC: indicates whether listOrderField value could be updated in the db. Used only if listOrderField!=null Default value is true. -
setDefaultSourceTable
PUBLIC: Set a default source table to use with the source fields of this mapping. -
hasNestedIdentityReference
public boolean hasNestedIdentityReference()INTERNAL: Indicates whether the mapping (or at least one of its nested mappings, at any nested depth) references an entity. To return true the mapping (or nested mapping) should be ForeignReferenceMapping with non-null and non-aggregate reference descriptor.- Overrides:
hasNestedIdentityReference
in classForeignReferenceMapping
-