Class AggregateMapping

    • Field Detail

      • referenceClass

        protected Class referenceClass
        Stores a reference class
      • referenceClassName

        protected String referenceClassName
      • referenceDescriptor

        protected ClassDescriptor referenceDescriptor
        The descriptor of the reference class
      • hasNestedIdentityReference

        protected Boolean 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 Detail

      • AggregateMapping

        public AggregateMapping()
        Default constructor.
    • Method Detail

      • buildAggregateModifyQuery

        protected void buildAggregateModifyQuery​(ObjectLevelModifyQuery sourceQuery,
                                                 ObjectLevelModifyQuery aggregateQuery,
                                                 Object sourceAttributeValue)
        Initialize the aggregate query with the settings from the source query.
      • buildAggregateWriteQuery

        protected WriteObjectQuery buildAggregateWriteQuery​(WriteObjectQuery sourceQuery,
                                                            Object sourceAttributeValue)
        Make a copy of the sourceQuery for the attribute.
      • buildBackupClone

        public void buildBackupClone​(Object clone,
                                     Object backup,
                                     org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork)
        INTERNAL: Clone the attribute from the clone and assign it to the backup.
        Specified by:
        buildBackupClone in class DatabaseMapping
      • buildBackupClonePart

        protected Object buildBackupClonePart​(Object attributeValue,
                                              org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork)
        INTERNAL: Build and return a backup clone of the attribute.
      • buildClone

        public void buildClone​(Object original,
                               org.eclipse.persistence.internal.identitymaps.CacheKey cacheKey,
                               Object clone,
                               Integer refreshCascade,
                               org.eclipse.persistence.internal.sessions.AbstractSession cloningSession)
        INTERNAL: Clone the attribute from the original and assign it to the clone.
        Specified by:
        buildClone in class DatabaseMapping
      • buildCloneFromRow

        public void buildCloneFromRow​(org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow,
                                      org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager,
                                      Object clone,
                                      org.eclipse.persistence.internal.identitymaps.CacheKey sharedCacheKey,
                                      ObjectBuildingQuery sourceQuery,
                                      org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork,
                                      org.eclipse.persistence.internal.sessions.AbstractSession executionSession)
        INTERNAL: A combination of readFromRowIntoObject and buildClone.

        buildClone assumes the attribute value exists on the original and can simply be copied.

        readFromRowIntoObject assumes that one is building an original.

        Both of the above assumptions are false in this method, and actually attempts to do both at the same time.

        Extract value from the row and set the attribute to this value in the working copy clone. In order to bypass the shared cache when in transaction a UnitOfWork must be able to populate working copies directly from the row.

        Specified by:
        buildCloneFromRow in class DatabaseMapping
      • buildClonePart

        protected Object buildClonePart​(Object original,
                                        Object clone,
                                        org.eclipse.persistence.internal.identitymaps.CacheKey cacheKey,
                                        Object attributeValue,
                                        Integer refreshCascade,
                                        org.eclipse.persistence.internal.sessions.AbstractSession cloningSession)
        INTERNAL: Build and return a clone of the attribute.
      • buildClonePart

        protected Object buildClonePart​(Object attributeValue,
                                        Object clone,
                                        org.eclipse.persistence.internal.identitymaps.CacheKey parentCacheKey,
                                        Integer refreshCascade,
                                        org.eclipse.persistence.internal.sessions.AbstractSession cloningSession,
                                        boolean isNewObject)
        INTERNAL: * Build and return a clone of the attribute.
      • buildCopy

        public void buildCopy​(Object copy,
                              Object original,
                              CopyGroup group)
        INTERNAL: Copy of the attribute of the object. This is NOT used for unit of work but for templatizing an object.
        buildCopy in class DatabaseMapping
      • buildCopyOfAttributeValue

        protected Object buildCopyOfAttributeValue​(Object attributeValue,
                                                   CopyGroup group)
        Copy of the attribute of the object. This is NOT used for unit of work but for templatizing an object.
      • 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.
        buildExpression in class DatabaseMapping
      • buildNewMergeInstanceOf

        protected Object buildNewMergeInstanceOf​(Object sourceAttributeValue,
                                                 org.eclipse.persistence.internal.sessions.AbstractSession session)
        INTERNAL: Build and return a new instance of the specified attribute. This will be populated by a merge.
      • compareAttributeValues

        protected boolean compareAttributeValues​(Object attributeValue1,
                                                 Object attributeValue2,
                                                 org.eclipse.persistence.internal.sessions.AbstractSession session)
        INTERNAL: Compare the attributes. Return true if they are alike.
      • 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: Compare the changes between two aggregates. Return a change record holding the changes.
        Specified by:
        compareForChange in class DatabaseMapping
      • 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.
        Specified by:
        compareObjects in class DatabaseMapping
      • convertClassNamesToClasses

        public void convertClassNamesToClasses​(ClassLoader classLoader)
        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.
        convertClassNamesToClasses in class DatabaseMapping
        classLoader -
      • executeEvent

        protected void executeEvent​(int eventCode,
                                    ObjectLevelModifyQuery query)
        INTERNAL: Execute a descriptor event for the specified event code.
      • fixAttributeValue

        protected void fixAttributeValue​(Object attributeValue,
                                         Map objectDescriptors,
                                         Map processedObjects,
                                         ObjectLevelReadQuery query,
                                         DistributedSession session)
        INTERNAL: An object has been serialized from the server to the remote client. Replace the transient attributes of the remote value holders with client-side objects.
      • getAttributeValueFromBackupClone

        protected Object getAttributeValueFromBackupClone​(Object backupClone)
        Return the appropriate attribute value. This method is a hack to allow the aggregate collection subclass to override....
      • getObjectBuilderForClass

        protected org.eclipse.persistence.internal.descriptors.ObjectBuilder getObjectBuilderForClass​(Class javaClass,
                                                                                                      org.eclipse.persistence.internal.sessions.AbstractSession session)
        Convenience method
      • getObjectBuilder

        protected org.eclipse.persistence.internal.descriptors.ObjectBuilder getObjectBuilder​(Object attributeValue,
                                                                                              org.eclipse.persistence.internal.sessions.AbstractSession session)
        Convenience method
      • getQueryManager

        protected DescriptorQueryManager getQueryManager​(Object attributeValue,
                                                         org.eclipse.persistence.internal.sessions.AbstractSession session)
        Convenience method
      • getReferenceClass

        public Class getReferenceClass()
        PUBLIC: Returns the reference class
      • getReferenceClassName

        public String getReferenceClassName()
        INTERNAL: Used by MW.
      • getReferenceDescriptor

        public ClassDescriptor 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.
        getReferenceDescriptor in class DatabaseMapping
      • getReferenceDescriptor

        protected ClassDescriptor getReferenceDescriptor​(Class theClass,
                                                         org.eclipse.persistence.internal.sessions.AbstractSession session)
        INTERNAL: For inheritance purposes.
      • getReferenceDescriptor

        protected ClassDescriptor getReferenceDescriptor​(Object attributeValue,
                                                         org.eclipse.persistence.internal.sessions.AbstractSession session)
        Convenience method
      • 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.
        hasNestedIdentityReference in class DatabaseMapping
      • isAggregateMapping

        public boolean isAggregateMapping()
        INTERNAL: Related mapping should implement this method to return true.
        isAggregateMapping in class DatabaseMapping
      • iterate

        public void iterate​(org.eclipse.persistence.internal.descriptors.DescriptorIterator iterator)
        INTERNAL: Iterate on the appropriate attribute value.
        Specified by:
        iterate in class DatabaseMapping
      • iterateOnAttributeValue

        protected void iterateOnAttributeValue​(org.eclipse.persistence.internal.descriptors.DescriptorIterator iterator,
                                               Object attributeValue)
        Iterate on the specified attribute value.
      • 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.
        load in class DatabaseMapping
      • 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.
        loadAll in class DatabaseMapping
      • mergeAttributeValue

        protected void mergeAttributeValue​(Object targetAttributeValue,
                                           boolean isTargetUnInitialized,
                                           Object sourceAttributeValue,
                                           org.eclipse.persistence.internal.sessions.MergeManager mergeManager,
                                           org.eclipse.persistence.internal.sessions.AbstractSession targetSession)
        Merge the attribute values.
      • mergeChangesIntoObject

        public void mergeChangesIntoObject​(Object target,
                                           org.eclipse.persistence.internal.sessions.ChangeRecord changeRecord,
                                           Object source,
                                           org.eclipse.persistence.internal.sessions.MergeManager mergeManager,
                                           org.eclipse.persistence.internal.sessions.AbstractSession targetSession)
        INTERNAL: Merge changes from the source to the target object. With aggregates the merge must cascade to the object changes for the aggregate object because aggregate objects have no identity outside of themselves. The actual aggregate object does not need to be replaced, because even if the clone references another aggregate it appears the same to TopLink
        Specified by:
        mergeChangesIntoObject in class DatabaseMapping
      • 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 class DatabaseMapping
      • remoteInitialization

        public void remoteInitialization​(DistributedSession session)
        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.
        remoteInitialization in class DatabaseMapping
      • setReferenceClass

        public void setReferenceClass​(Class aClass)
        PUBLIC: This is a reference class whose instances this mapping will store in the domain objects.
      • setReferenceClassName

        public void setReferenceClassName​(String aClassName)
        INTERNAL: Used by MW.
      • setReferenceDescriptor

        protected void setReferenceDescriptor​(ClassDescriptor aDescriptor)
        INTERNAL: Set the referenceDescriptor. This is a descriptor which is associated with the reference class.
      • updateChangeRecord

        public void updateChangeRecord​(Object sourceClone,
                                       Object newValue,
                                       Object oldValue,
                                       org.eclipse.persistence.internal.sessions.ObjectChangeSet objectChangeSet,
                                       org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow)
                                throws DescriptorException
        INTERNAL: Either create a new change record or update the change record with the new value. This is used by attribute change tracking.
        updateChangeRecord in class DatabaseMapping
      • verifyDeleteOfAttributeValue

        protected boolean verifyDeleteOfAttributeValue​(Object attributeValue,
                                                       org.eclipse.persistence.internal.sessions.AbstractSession session)
                                                throws DatabaseException
        INTERNAL: Return whether the specified object and all its components have been deleted.