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.
| Modifier and Type | Field and Description |
|---|---|
| protected Map | aggregateToSourceFields
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 transient DataModifyQuery | |
| protected Map | converters
List of converters to apply at initialize time to their cloned aggregate mappings. |
| protected DatabaseTable | defaultSourceTable
Default source table that should be used with the default source fields of this mapping. |
| protected Boolean | hasNestedIdentityReference
Indicates whether the mapping (or at least one of its nested mappings, at any nested depth) references an entity. |
| protected boolean | isEntireObjectPK
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 | isListOrderFieldUpdatable
indicates whether listOrderField value could be updated in the db. |
| protected static final String | |
| protected static final String | |
| protected Map | nestedAggregateToSourceFields
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 transient DataModifyQuery | |
| protected ClassDescriptor | remoteReferenceDescriptor
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 | sourceKeyFields
This is a primary key in the source table that is used as foreign key in the target table |
| protected Vector | targetForeignKeyFields
This is a key in the target table which is a foreign key in the target table. |
| protected Map | targetForeignKeyToSourceKeys
Foreign keys in the target table to the related keys in the source table |
| protected transient DataModifyQuery | updateListOrderFieldQuery
These queries used to update listOrderField |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | addConverter(Converter converter, String attributeName)
Implements org. |
| public void | addFieldNameTranslation(String sourceFieldName, String aggregateFieldName)
PUBLIC: Maps a field name in the aggregate descriptor to a field name in the source table. |
| public void | addFieldTranslation(DatabaseField sourceField, String aggregateField)
Implements org. |
| public void | addFieldTranslations(Map<String, DatabaseField> map)
PUBLIC: Maps a field name in the aggregate descriptor to a field name in the source table. |
| 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. |
| public 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. |
| public void | addNestedFieldTranslation(String attributeName, DatabaseField sourceField, String aggregateFieldName)
Implements org. |
| public void | addOverrideManyToManyMapping(ManyToManyMapping mapping)
Implements org. |
| public void | addOverrideUnidirectionalOneToManyMapping(UnidirectionalOneToManyMapping mapping)
Implements org. |
| public void | addTargetForeignKeyField(DatabaseField targetForeignKey, DatabaseField sourceKey)
Overrides org. |
| public void | addTargetForeignKeyFieldName(String targetForeignKey, String sourceKey)
PUBLIC: Define the target foreign key relationship in the 1-M aggregate collection mapping. |
| public Object | buildBackupCloneForPartObject(Object
TODO attributeValue, Object TODO clone, Object TODO backup, UnitOfWorkImpl TODO unitOfWork)Overrides org. |
| protected Expression | buildBatchCriteria(ExpressionBuilder builder, ObjectLevelReadQuery query)
Overrides org. |
| public Object | buildCloneForPartObject(Object
TODO attributeValue, Object TODO original, CacheKey TODO cacheKey, Object TODO clone, AbstractSession TODO cloningSession, Integer TODO refreshCascade, boolean TODO isExisting, boolean TODO isFromSharedCache)Overrides org. |
| protected Object | buildElementBackupClone(Object element, UnitOfWorkImpl unitOfWork)
INTERNAL: Clone the aggregate collection, if necessary. |
| public Object | buildElementClone(Object element, Object parent, CacheKey parentCacheKey, Integer refreshCascade, AbstractSession cloningSession, boolean isExisting, boolean isFromSharedCache)
Overrides org. |
| public Expression | buildExpression(Object
TODO queryObject, QueryByExamplePolicy TODO policy, Expression TODO expressionBuilder, Map<K, V> TODO processedObjects, AbstractSession TODO session)Overrides org. |
| public void | cascadeDiscoverAndPersistUnregisteredNewObjects(Object
TODO object, Map<K, V> TODO newObjects, Map<K, V> TODO unregisteredExistingObjects, Map<K, V> TODO visitedObjects, UnitOfWorkImpl TODO uow, Set<E> TODO cascadeErrors)Overrides org. |
| public void | cascadePerformRemoveIfRequired(Object
TODO object, UnitOfWorkImpl TODO uow, Map<K, V> TODO visitedObjects)Overrides org. |
| public void | cascadePerformRemovePrivateOwnedObjectFromChangeSetIfRequired(Object
TODO object, UnitOfWorkImpl TODO uow, Map<K, V> TODO visitedObjects)
INTERNAL:
Cascade perform removal of orphaned private owned objects from the UnitOfWorkChangeSet
|
| public void | cascadeRegisterNewIfRequired(Object
TODO object, UnitOfWorkImpl TODO uow, Map<K, V> TODO visitedObjects)Overrides org. |
| public Object | clone()
Overrides org. Implements org. |
| public void | collectQueryParameters(Set<DatabaseField>
TODO cacheFields)Overrides org. |
| public ChangeRecord | Returns: ChangeRecordTODO clone, Object TODO backUp, ObjectChangeSet TODO owner, AbstractSession TODO session)Overrides org. |
| public boolean | compareLists(List<E> firstList, List<E> secondList, AbstractSession session)
INTERNAL: Compare the attributes belonging to this mapping for the objects. |
| protected void | compareListsAndWrite(List<E> previousList, List<E> currentList, WriteObjectQuery query)
Overrides org. |
| protected void | compareListsAndWrite_NonUpdatableListOrderField(List<E> previousList, List<E> currentList, WriteObjectQuery query)
INTERNAL: Old and new lists are compared and only the changes are written to the database. |
| protected void | compareListsAndWrite_UpdatableListOrderField(List<E> previousList, List<E> currentList, WriteObjectQuery query)
INTERNAL: Old and new lists are compared and only the changes are written to the database. |
| protected boolean | compareMapCollectionForChange(Map<K, V> cloneObjectCollection, Map<K, V> 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. |
| public boolean | compareObjects(Object
TODO firstObject, Object TODO secondObject, AbstractSession TODO session)Overrides org. |
| public void | convertClassNamesToClasses(ClassLoader
Where to search for classes. classLoader)Overrides org. |
| protected ChangeRecord | Returns: org.eclipse.persistence.internal.sessions.AggregateCollectionChangeRecord the changerecord representing this AggregateCollectionMappingObject the collection to convert cloneCollection, Object backupCollection, ObjectChangeSet org.eclipse.persistence.internal.sessions.ObjectChangeSet the ChangeSet that uses this record owner, AbstractSession org.eclipse.persistence.internal.sessions.AbstractSession session)INTERNAL: This method is used to convert the contents of an aggregateCollection into a changeRecord |
| protected Object | copyElement(Object original, CopyGroup group)
Overrides org. |
| public Object | createMapComponentFromRow(AbstractRecord dbRow, ObjectBuildingQuery query, CacheKey parentCacheKey, AbstractSession session, boolean isTargetProtected)
Implements org. |
| protected void | deleteAll(DeleteObjectQuery query, AbstractSession session)
To delete all the entries matching the selection criteria from the table stored in the referenced descriptor |
| protected void | executeEvent(int eventCode, ObjectLevelModifyQuery query)
INTERNAL: Execute a descriptor event for the specified event code. |
| protected Object | extractBatchKeyFromRow(AbstractRecord row, AbstractSession session)
Overrides org. |
| protected Object | extractKeyFromTargetRow(AbstractRecord row, AbstractSession session)
Overrides org. |
| public AbstractRecord | getAggregateRow(ObjectLevelModifyQuery query, Object object)
INTERNAL: return the aggregate Record with the primary keys from the source table and target table |
| public InsertObjectQuery | getAndPrepareModifyQueryForInsert(ObjectLevelModifyQuery originalQuery, Object object)
INTERNAL: setup the modifyQuery for post insert/update and pre delete |
| protected Expression | getDeleteAllCriteria(AbstractSession session)
Delete all criteria is created with target foreign keys and source keys. |
| protected ModifyQuery | getDeleteAllQuery()
Overrides org. |
| protected InsertObjectQuery | getInsertObjectQuery(AbstractSession session, ClassDescriptor desc)
INTERNAL: Returns a clone of InsertObjectQuery from the ClassDescriptor's DescriptorQueryManager or a new one |
| public ClassDescriptor | getReferenceDescriptor()
Overrides org. |
| public ClassDescriptor | |
| public Vector | |
| public Vector | |
| public Vector | |
| public Vector | getTargetForeignKeyFieldNames()
PUBLIC: Return the target foregin key field names associated with the mapping. |
| public Vector | getTargetForeignKeyFields()
INTERNAL: Return the target foregin key fields associated with the mapping |
| public Map | |
| public boolean | hasNestedIdentityReference()
Overrides org. |
| public void | initialize(AbstractSession session)
Overrides org. |
| public 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 | |
| public 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 | initializeReferenceDescriptor(AbstractSession session)
Overrides org. |
| protected void | initializeSelectionCriteria(AbstractSession session)
INTERNAL: Selection criteria is created with target foreign keys and source keys. |
| protected void | initializeTargetForeignKeyToSourceKeys(AbstractSession session)
INTERNAL: The foreign keys and the primary key names are converted to DatabaseFields and stored. |
| protected void | initializeTargetForeignKeyToSourceKeysWithDefaults(AbstractSession session)
INTERNAL: The foreign keys and the primary key names are converted to DatabaseFields and stored. |
| protected void | |
| public boolean | |
| public boolean | isCandidateForPrivateOwnedRemoval()
Overrides org. |
| public boolean | isCascadedLockingSupported()
Overrides org. |
| public boolean | isChangeTrackingSupported(Project project)
Overrides org. |
| public boolean | |
| public boolean | isJoiningSupported()
Overrides org. |
| public boolean | isListOrderFieldUpdatable()
PUBLIC: indicates whether listOrderField value could be updated in the db. |
| public boolean | |
| public boolean | isRelationalMapping()
Overrides org. |
| protected boolean | |
| public void | iterateOnElement(DescriptorIterator iterator, Object element)
Overrides org. |
| public void | load(final Object object, AttributeItem item, final AbstractSession session, final boolean fromFetchGroup)
Overrides org. |
| public void | loadAll(Object object, AbstractSession session, IdentityHashSet loaded)
Overrides org. |
| public void | mergeChangesIntoObject(Object target, ChangeRecord changeRecord, Object source, MergeManager mergeManager, AbstractSession targetSession)
Overrides org. |
| public void | mergeIntoObject(Object target, boolean isTargetUnInitialized, Object source, MergeManager mergeManager, AbstractSession targetSession)
Overrides org. |
| protected void | objectAddedDuringUpdate(ObjectLevelModifyQuery query, Object objectAdded, ObjectChangeSet changeSet, Map<K, V> extraData)
Overrides org. |
| protected int | |
| protected int | |
| protected void | objectRemovedDuringUpdate(ObjectLevelModifyQuery query, Object objectDeleted, Map<K, V> extraData)
Overrides org. |
| protected void | objectUnchangedDuringUpdate(ObjectLevelModifyQuery query, Object object, Map<K, V> backupCloneKeyedCache, Object cachedKey)
Overrides org. |
| protected void | |
| public void | postInitialize(AbstractSession session)
Overrides org. |
| public void | postInsert(WriteObjectQuery query)
Overrides org. |
| protected void | postPrepareNestedBatchQuery(ReadQuery batchQuery, ObjectLevelReadQuery query)
Overrides org. |
| public void | postUpdate(WriteObjectQuery writeQuery)
Overrides org. |
| public void | preDelete(DeleteObjectQuery query)
Overrides org. |
| public void | preInsert(WriteObjectQuery query)
Overrides org. |
| public void | prepareModifyQueryForDelete(ObjectLevelModifyQuery originalQuery, ObjectLevelModifyQuery modifyQuery, Object wrappedObject, Map<K, V> extraData)
INTERNAL: setup the modifyQuery for pre delete |
| public void | prepareModifyQueryForUpdate(ObjectLevelModifyQuery originalQuery, ObjectLevelModifyQuery modifyQuery, Object object)
INTERNAL: setup the modifyQuery for update, |
| public ObjectLevelReadQuery | prepareNestedJoins(JoinedAttributeManager joinManager, ObjectBuildingQuery baseQuery, AbstractSession session)
Overrides org. |
| public void | remoteInitialization(DistributedSession session)
Overrides org. |
| public void | setDefaultSourceTable(DatabaseTable table)
PUBLIC: Set a default source table to use with the source fields of this mapping. |
| public void | setIsListOrderFieldUpdatable(boolean isUpdatable)
PUBLIC: indicates whether listOrderField value could be updated in the db. |
| protected void | setReferenceDescriptor(ClassDescriptor aDescriptor)
Overrides org. |
| public void | setSourceKeyFieldNames(Vector<E> fieldNames)
PUBLIC: Set the source key field names associated with the mapping. |
| public void | setSourceKeyFields(Vector<DatabaseField> sourceKeyFields)
INTERNAL: set all the primary key names associated with this mapping |
| public void | setTargetForeignKeyFieldNames(Vector<E> fieldNames)
PUBLIC: Set the target foregin key field names associated with the mapping. |
| public void | setTargetForeignKeyFields(Vector<DatabaseField> targetForeignKeyFields)
INTERNAL: set the target foregin key fields associated with the mapping |
| protected void | |
| protected boolean | shouldObjectModifyCascadeToParts(ObjectLevelModifyQuery query)
Overrides org. |
| public void | simpleAddToCollectionChangeRecord(Object referenceKey, Object changeSetToAdd, ObjectChangeSet changeSet, AbstractSession session)
Overrides org. |
| public void | simpleRemoveFromCollectionChangeRecord(Object referenceKey, Object changeSetToRemove, ObjectChangeSet changeSet, AbstractSession session)
Overrides org. |
| 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. |
| protected void | updateNestedAggregateMappings(ClassDescriptor descriptor, AbstractSession session)
INTERNAL: Called in case nestedAggregateToSourceFieldNames != null Updates AggregateObjectMappings and AggregateCollectionMappings of the reference descriptor. |
| public boolean | verifyDelete(Object object, AbstractSession session)
Overrides org. |
| protected void | verifyDeleteForUpdate(DeleteObjectQuery query)
Verifying deletes make sure that all the records privately owned by this mapping are actually removed. |