Class AggregateObjectMapping

    • Constructor Detail

      • AggregateObjectMapping

        public AggregateObjectMapping()
        Default constructor.
    • Method Detail

      • addAdditionalFieldsToQuery

        public void addAdditionalFieldsToQuery​(ReadQuery selectionQuery,
                                               Expression baseExpression)
        INTERNAL: Used when initializing queries for mappings that use a Map Called when the selection query is being initialized to add the fields for the map key to the query
        Specified by:
        addAdditionalFieldsToQuery in interface MapKeyMapping
      • addConverter

        public void addConverter​(Converter converter,
                                 String attributeName)
        Add a converter to be applied to a mapping of the aggregate descriptor.
        Specified by:
        addConverter in interface EmbeddableMapping
      • addFieldsForMapKey

        public void addFieldsForMapKey​(org.eclipse.persistence.internal.sessions.AbstractRecord joinRow)
        INTERNAL: Used when initializing queries for mappings that use a Map Called when the insert query is being initialized to ensure the fields for the map key are in the insert query
        Specified by:
        addFieldsForMapKey in interface MapKeyMapping
      • addFieldNameTranslation

        public void addFieldNameTranslation​(String sourceFieldName,
                                            String aggregateFieldName)
        PUBLIC: Add a field name translation that maps from a field name in the source table to a field name in the aggregate descriptor.
      • addFieldTranslation

        public void addFieldTranslation​(org.eclipse.persistence.internal.helper.DatabaseField sourceField,
                                        String aggregateFieldName)
        PUBLIC: Add a field translation that maps from a field in the source table to a field name in the aggregate descriptor.
        Specified by:
        addFieldTranslation in interface EmbeddableMapping
      • addMapsIdMapping

        public void addMapsIdMapping​(DatabaseMapping mapping)
        INTERNAL: In JPA users may specify a maps id mapping on a shared embeddable descriptor. These mappings need to be set to read-only at initialize time, after the reference descriptor is cloned.
      • addNestedFieldTranslation

        public void addNestedFieldTranslation​(String attributeName,
                                              org.eclipse.persistence.internal.helper.DatabaseField sourceField,
                                              String aggregateFieldName)
        INTERNAL: Add a nested field translation that maps from a field in the source table to a field name in a nested aggregate descriptor. These are handled slightly different that regular field translations in that they are unique based on the attribute name. It solves the case where multiple nested embeddables have mappings to similarly named default columns.
        Specified by:
        addNestedFieldTranslation in interface EmbeddableMapping
      • addOverrideManyToManyMapping

        public void addOverrideManyToManyMapping​(ManyToManyMapping mapping)
        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.
        Specified by:
        addOverrideManyToManyMapping in interface EmbeddableMapping
      • addOverrideUnidirectionalOneToManyMapping

        public void addOverrideUnidirectionalOneToManyMapping​(UnidirectionalOneToManyMapping mapping)
        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.
        Specified by:
        addOverrideUnidirectionalOneToManyMapping in interface EmbeddableMapping
      • addKeyToDeletedObjectsList

        public void addKeyToDeletedObjectsList​(Object object,
                                               Map deletedObjects)
        INTERNAL: For mappings used as MapKeys in MappedKeyContainerPolicy. Add the target of this mapping to the deleted objects list if necessary This method is used for removal of private owned relationships. AggregateObjectMappings are dealt with in their parent delete, so this is a no-op.
        Specified by:
        addKeyToDeletedObjectsList in interface MapKeyMapping
        Parameters:
        object -
        deletedObjects -
      • allowNull

        public void allowNull()
        PUBLIC: If all the fields in the database row for the aggregate object are NULL, then, by default, the mapping will place a null in the appropriate source object (as opposed to an aggregate object filled with nulls). This behavior can be explicitly set by calling #allowNull(). To change this behavior, call #dontAllowNull(). Then the mapping will build a new instance of the aggregate object that is filled with nulls and place it in the source object. In either situation, when writing, the mapping will place a NULL in all the fields in the database row for the aggregate object. Note: Any aggregate that has a relationship mapping automatically does not allow null.
      • prepareNestedQuery

        public ObjectBuildingQuery prepareNestedQuery​(ObjectBuildingQuery sourceQuery)
        INTERNAL: Clone and prepare the selection query as a nested batch read query. This is used for nested batch reading.
      • buildAggregateFromRow

        public Object buildAggregateFromRow​(org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow,
                                            Object targetObject,
                                            org.eclipse.persistence.internal.identitymaps.CacheKey cacheKey,
                                            org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager,
                                            ObjectBuildingQuery sourceQuery,
                                            boolean buildShallowOriginal,
                                            org.eclipse.persistence.internal.sessions.AbstractSession executionSession,
                                            boolean targetIsProtected)
                                     throws DatabaseException
        INTERNAL: Build and return an aggregate object from the specified row. If a null value is allowed and all the appropriate fields in the row are NULL, return a null. If an aggregate is referenced by the target object, return it (maintain identity) Otherwise, simply create a new aggregate object and return it.
        Throws:
        DatabaseException
      • buildObjectJoinExpression

        public Expression buildObjectJoinExpression​(Expression expression,
                                                    Object value,
                                                    org.eclipse.persistence.internal.sessions.AbstractSession session)
        INTERNAL: Used to allow object level comparisons. In the case of an Aggregate which has no primary key must do an attribute by attribute comparison.
        Overrides:
        buildObjectJoinExpression in class DatabaseMapping
      • 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.
        Overrides:
        buildClone in class AggregateMapping
      • buildElementClone

        public Object buildElementClone​(Object attributeValue,
                                        Object parent,
                                        org.eclipse.persistence.internal.identitymaps.CacheKey parentCacheKey,
                                        Integer refreshCascade,
                                        org.eclipse.persistence.internal.sessions.AbstractSession cloningSession,
                                        boolean isExisting,
                                        boolean isFromSharedCache)
        INTERNAL: Build a clone of the given element in a unitOfWork
        Specified by:
        buildElementClone in interface MapKeyMapping
        Parameters:
        attributeValue -
        parent -
        parentCacheKey -
        refreshCascade -
        cloningSession -
        isExisting -
        isFromSharedCache -
        Returns:
      • 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.

        Overrides:
        buildCloneFromRow in class AggregateMapping
      • buildShallowOriginalFromRow

        public void buildShallowOriginalFromRow​(org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow,
                                                Object original,
                                                org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager,
                                                ObjectBuildingQuery sourceQuery,
                                                org.eclipse.persistence.internal.sessions.AbstractSession executionSession)
        INTERNAL: Builds a shallow original object. Only direct attributes and primary keys are populated. In this way the minimum original required for instantiating a working copy clone can be built without placing it in the shared cache (no concern over cycles).
        Overrides:
        buildShallowOriginalFromRow in class DatabaseMapping
      • buildSelectionQueryForDirectCollectionKeyMapping

        public ReadQuery buildSelectionQueryForDirectCollectionKeyMapping​(org.eclipse.persistence.internal.queries.ContainerPolicy containerPolicy)
        INTERNAL: Certain key mappings favor different types of selection query. Return the appropriate type of selectionQuery
        Specified by:
        buildSelectionQueryForDirectCollectionKeyMapping in interface MapKeyMapping
        Returns:
      • cascadeDiscoverAndPersistUnregisteredNewObjects

        public void cascadeDiscoverAndPersistUnregisteredNewObjects​(Object object,
                                                                    Map newObjects,
                                                                    Map unregisteredExistingObjects,
                                                                    Map visitedObjects,
                                                                    org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow,
                                                                    boolean getAttributeValueFromObject,
                                                                    Set cascadeErrors)
        INTERNAL: Cascade discover and persist new objects during commit to the map key
        Specified by:
        cascadeDiscoverAndPersistUnregisteredNewObjects in interface MapKeyMapping
      • cascadePerformRemoveIfRequired

        public void cascadePerformRemoveIfRequired​(Object object,
                                                   org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow,
                                                   Map visitedObjects,
                                                   boolean getAttributeValueFromObject)
        INTERNAL: Cascade perform delete through mappings that require the cascade
        Specified by:
        cascadePerformRemoveIfRequired in interface MapKeyMapping
      • cascadePerformRemoveIfRequired

        public void cascadePerformRemoveIfRequired​(Object object,
                                                   org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow,
                                                   Map visitedObjects)
        INTERNAL: Cascade perform delete through mappings that require the cascade
        Specified by:
        cascadePerformRemoveIfRequired in class DatabaseMapping
      • cascadePerformRemovePrivateOwnedObjectFromChangeSetIfRequired

        public void cascadePerformRemovePrivateOwnedObjectFromChangeSetIfRequired​(Object object,
                                                                                  org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow,
                                                                                  Map visitedObjects)
        INTERNAL: Cascade perform removal of orphaned private owned objects from the UnitOfWorkChangeSet
        Overrides:
        cascadePerformRemovePrivateOwnedObjectFromChangeSetIfRequired in class DatabaseMapping
      • cascadeRegisterNewIfRequired

        public void cascadeRegisterNewIfRequired​(Object object,
                                                 org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow,
                                                 Map visitedObjects,
                                                 boolean getAttributeValueFromObject)
        INTERNAL: Cascade registerNew for Create through mappings that require the cascade
        Specified by:
        cascadeRegisterNewIfRequired in interface MapKeyMapping
      • cascadeRegisterNewIfRequired

        public void cascadeRegisterNewIfRequired​(Object object,
                                                 org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow,
                                                 Map visitedObjects)
        INTERNAL: Cascade registerNew for Create through mappings that require the cascade
        Specified by:
        cascadeRegisterNewIfRequired in class DatabaseMapping
      • clone

        public Object clone()
        INTERNAL: Clone the aggregate to source field names. AggregateCollectionMapping needs each nested embedded mapping to have its own list of aggregate to source field names so that it can apply nested override names to shared aggregate object mappings.
        Specified by:
        clone in interface MapComponentMapping
        Overrides:
        clone in class DatabaseMapping
      • collectQueryParameters

        public void collectQueryParameters​(Set<org.eclipse.persistence.internal.helper.DatabaseField> record)
        INTERNAL: This method is used to store the FK fields that can be cached that correspond to noncacheable mappings the FK field values will be used to re-issue the query when cloning the shared cache entity
        Overrides:
        collectQueryParameters 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.
        Overrides:
        convertClassNamesToClasses in class AggregateMapping
        Parameters:
        classLoader -
      • createMapComponentFromRow

        public Object createMapComponentFromRow​(org.eclipse.persistence.internal.sessions.AbstractRecord dbRow,
                                                ObjectBuildingQuery query,
                                                org.eclipse.persistence.internal.identitymaps.CacheKey parentCacheKey,
                                                org.eclipse.persistence.internal.sessions.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 interface MapComponentMapping
      • createSerializableMapKeyInfo

        public Object createSerializableMapKeyInfo​(Object key,
                                                   org.eclipse.persistence.internal.sessions.AbstractSession session)
        INTERNAL: Creates the Array of simple types used to recreate this map.
        Specified by:
        createSerializableMapKeyInfo in interface MapKeyMapping
      • createMapComponentsFromSerializableKeyInfo

        public List<Object> createMapComponentsFromSerializableKeyInfo​(Object[] keyInfo,
                                                                       org.eclipse.persistence.internal.sessions.AbstractSession session)
        INTERNAL: Create an instance of the Key object from the key information extracted from the map. This may return the value directly in case of a simple key or will be used as the FK to load a related entity.
        Specified by:
        createMapComponentsFromSerializableKeyInfo in interface MapKeyMapping
      • createStubbedMapComponentFromSerializableKeyInfo

        public Object createStubbedMapComponentFromSerializableKeyInfo​(Object keyInfo,
                                                                       org.eclipse.persistence.internal.sessions.AbstractSession session)
        INTERNAL: Create an instance of the Key object from the key information extracted from the map. This key object may be a shallow stub of the actual object if the key is an Entity type.
        Specified by:
        createStubbedMapComponentFromSerializableKeyInfo in interface MapKeyMapping
      • createMapComponentFromJoinedRow

        public Object createMapComponentFromJoinedRow​(org.eclipse.persistence.internal.sessions.AbstractRecord dbRow,
                                                      org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManger,
                                                      ObjectBuildingQuery query,
                                                      org.eclipse.persistence.internal.identitymaps.CacheKey parentCacheKey,
                                                      org.eclipse.persistence.internal.sessions.AbstractSession session,
                                                      boolean isTargetProtected)
        INTERNAL Called when a DatabaseMapping is used to map the key in a collection and a join query is executed. Returns the key.
        Specified by:
        createMapComponentFromJoinedRow in interface MapKeyMapping
      • deleteMapKey

        public void deleteMapKey​(Object objectDeleted,
                                 org.eclipse.persistence.internal.sessions.AbstractSession session)
        INTERNAL: For mappings used as MapKeys in MappedKeyContainerPolicy, Delete the passed object if necessary. This method is used for removal of private owned relationships. AggregateObjectMappings are dealt with in their parent delete, so this is a no-op.
        Specified by:
        deleteMapKey in interface MapKeyMapping
        Parameters:
        objectDeleted -
        session -
      • dontAllowNull

        public void dontAllowNull()
        PUBLIC: If all the fields in the database row for the aggregate object are NULL, then, by default, the mapping will place a null in the appropriate source object (as opposed to an aggregate object filled with nulls). This behavior can be explicitly set by calling #allowNull(). To change this behavior, call #dontAllowNull(). Then the mapping will build a new instance of the aggregate object that is filled with nulls and place it in the source object. In either situation, when writing, the mapping will place a NULL in all the fields in the database row for the aggregate object. Note: Any aggregate that has a relationship mapping automatically does not allow null.
      • extractIdentityFieldsForQuery

        public Map extractIdentityFieldsForQuery​(Object object,
                                                 org.eclipse.persistence.internal.sessions.AbstractSession session)
        INTERNAL: Extract the fields for the Map key from the object to use in a query.
        Specified by:
        extractIdentityFieldsForQuery in interface MapKeyMapping
        Returns:
      • getAdditionalTablesForJoinQuery

        public List<org.eclipse.persistence.internal.helper.DatabaseTable> getAdditionalTablesForJoinQuery()
        INTERNAL: Return any tables that will be required when this mapping is used as part of a join query
        Specified by:
        getAdditionalTablesForJoinQuery in interface MapKeyMapping
        Returns:
      • getAdditionalSelectionCriteriaForMapKey

        public Expression getAdditionalSelectionCriteriaForMapKey()
        INTERNAL: Return the selection criteria necessary to select the target object when this mapping is a map key. AggregateObjectMappings do not need any additional selection criteria when they are map keys
        Specified by:
        getAdditionalSelectionCriteriaForMapKey in interface MapKeyMapping
        Returns:
      • getAggregateToSourceFieldAssociations

        public Vector<Association> getAggregateToSourceFieldAssociations()
        INTERNAL: Return a collection of the aggregate to source field associations.
      • getAggregateToSourceFields

        public Map<String,​org.eclipse.persistence.internal.helper.DatabaseField> getAggregateToSourceFields()
        INTERNAL: Return the hashtable that stores aggregate field name to source fields.
      • getFieldClassification

        public Class getFieldClassification​(org.eclipse.persistence.internal.helper.DatabaseField fieldToClassify)
        INTERNAL: Return the classification for the field contained in the mapping. This is used to convert the row value to a consistent Java value.
        Overrides:
        getFieldClassification in class DatabaseMapping
      • getIdentityFieldsForMapKey

        public List<org.eclipse.persistence.internal.helper.DatabaseField> getIdentityFieldsForMapKey()
        INTERNAL: Return the fields that make up the identity of the mapped object. For mappings with a primary key, it will be the set of fields in the primary key. For mappings without a primary key it will likely be all the fields
        Specified by:
        getIdentityFieldsForMapKey in interface MapKeyMapping
        Returns:
      • getAllFieldsForMapKey

        public List<org.eclipse.persistence.internal.helper.DatabaseField> getAllFieldsForMapKey()
        INTERNAL: Get all the fields for the map key
        Specified by:
        getAllFieldsForMapKey in interface MapKeyMapping
      • getForeignKeyFieldsForMapKey

        public Map<org.eclipse.persistence.internal.helper.DatabaseField,​org.eclipse.persistence.internal.helper.DatabaseField> getForeignKeyFieldsForMapKey()
        INTERNAL: Return a Map of any foreign keys defined within the the MapKey
        Specified by:
        getForeignKeyFieldsForMapKey in interface MapKeyMapping
        Returns:
      • getNestedJoinQuery

        public ObjectLevelReadQuery getNestedJoinQuery​(org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager,
                                                       ObjectLevelReadQuery query,
                                                       org.eclipse.persistence.internal.sessions.AbstractSession session)
        INTERNAL: Return the query that is used when this mapping is part of a joined relationship This method is used when this mapping is used to map the key in a Map
        Specified by:
        getNestedJoinQuery in interface MapKeyMapping
        Returns:
      • getReferenceDescriptor

        public ClassDescriptor getReferenceDescriptor​(Class theClass,
                                                      org.eclipse.persistence.internal.sessions.AbstractSession session)
        INTERNAL: Since aggregate object mappings clone their descriptors, for inheritance the correct child clone must be found.
      • getTargetVersionOfSourceObject

        public Object getTargetVersionOfSourceObject​(Object object,
                                                     Object parent,
                                                     org.eclipse.persistence.internal.sessions.MergeManager mergeManager,
                                                     org.eclipse.persistence.internal.sessions.AbstractSession targetSession)
        INTERNAL: If required, get the targetVersion of the source object from the merge manager. Used with MapKeyContainerPolicy to abstract getting the target version of a source key
        Specified by:
        getTargetVersionOfSourceObject in interface MapKeyMapping
        Returns:
      • getMapKeyTargetType

        public Object getMapKeyTargetType()
        INTERNAL: Return the class this key mapping maps or the descriptor for it
        Specified by:
        getMapKeyTargetType in interface MapKeyMapping
        Returns:
      • hasDependency

        public boolean hasDependency()
        INTERNAL: Return if the mapping has any ownership or other dependency over its target object(s).
        Overrides:
        hasDependency in class DatabaseMapping
      • initialize

        public void initialize​(org.eclipse.persistence.internal.sessions.AbstractSession session)
                        throws DescriptorException
        INTERNAL: For an aggregate 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:
        initialize in class AggregateMapping
        Throws:
        DescriptorException
      • initializeChildInheritance

        public void initializeChildInheritance​(ClassDescriptor parentDescriptor,
                                               org.eclipse.persistence.internal.sessions.AbstractSession session)
                                        throws DescriptorException
        INTERNAL: For an aggregate mapping the reference descriptor is cloned. If the reference descriptor is involved in an inheritance tree, all the parent and child descriptors are cloned also. The cloned descriptors are then assigned primary keys and table names before initialize. This is a very specific behavior for aggregate mappings.
        Throws:
        DescriptorException
      • initializeParentInheritance

        public void initializeParentInheritance​(ClassDescriptor parentDescriptor,
                                                ClassDescriptor childDescriptor,
                                                org.eclipse.persistence.internal.sessions.AbstractSession session)
                                         throws DescriptorException
        INTERNAL: For an aggregate mapping the reference descriptor is cloned. If the reference descriptor is involved in an inheritance tree, all the parent and child descriptors are cloned also. The cloned descriptors are then assigned primary keys and table names before initialize. This is a very specific behavior for aggregate mappings.
        Throws:
        DescriptorException
      • iterateOnMapKey

        public void iterateOnMapKey​(org.eclipse.persistence.internal.descriptors.DescriptorIterator iterator,
                                    Object element)
        INTERNAL: Called when iterating through descriptors to handle iteration on this mapping when it is used as a MapKey
        Specified by:
        iterateOnMapKey in interface MapKeyMapping
        Parameters:
        iterator -
        element -
      • isLockableMapping

        public boolean isLockableMapping()
        INTERNAL: Return whether this mapping should be traversed when we are locking
        Overrides:
        isLockableMapping in class DatabaseMapping
        Returns:
      • isAggregateObjectMapping

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

        public boolean isCascadedLockingSupported()
        INTERNAL Return true if this mapping supports cascaded version optimistic locking.
        Overrides:
        isCascadedLockingSupported in class DatabaseMapping
      • isJPAIdNested

        public boolean isJPAIdNested​(org.eclipse.persistence.internal.sessions.AbstractSession session)
        INTERNAL: Flags that either this mapping or nested mapping is a JPA id mapping.
      • isNullAllowed

        public boolean isNullAllowed()
        PUBLIC: Return if all the fields in the database row for the aggregate object are NULL, then, by default, the mapping will place a null in the appropriate source object (as opposed to an aggregate object filled with nulls). To change this behavior, set the value of this variable to false. Then the mapping will build a new instance of the aggregate object that is filled with nulls and place it in the source object. Note: Any aggregate that has a relationship mapping automatically does not allow null.
      • postInitialize

        public void postInitialize​(org.eclipse.persistence.internal.sessions.AbstractSession session)
                            throws DescriptorException
        INTERNAL: For an aggregate 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 class DatabaseMapping
        Throws:
        DescriptorException
      • preinitializeMapKey

        public void preinitializeMapKey​(org.eclipse.persistence.internal.helper.DatabaseTable table)
        INTERNAL: Making any mapping changes necessary to use a the mapping as a map key prior to initializing the mapping
        Specified by:
        preinitializeMapKey in interface MapKeyMapping
      • postInitializeMapKey

        public void postInitializeMapKey​(org.eclipse.persistence.internal.queries.MappedKeyMapContainerPolicy policy)
        INTERNAL: Making any mapping changes necessary to use a the mapping as a map key after initializing the mapping.
        Specified by:
        postInitializeMapKey in interface MapKeyMapping
      • readFromReturnRowIntoObject

        public Object readFromReturnRowIntoObject​(org.eclipse.persistence.internal.sessions.AbstractRecord row,
                                                  Object targetObject,
                                                  ReadObjectQuery query,
                                                  Collection handledMappings,
                                                  org.eclipse.persistence.internal.sessions.ObjectChangeSet changeSet)
                                           throws DatabaseException
        INTERNAL: Build an aggregate object from the specified return row and put it in the specified target object. Return row is merged into object after execution of insert or update call according to ReturningPolicy. If not null changeSet must correspond to targetObject. changeSet is updated with all of the field values in the row.
        Throws:
        DatabaseException
      • readFromRowIntoObject

        public Object readFromRowIntoObject​(org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow,
                                            org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager,
                                            Object targetObject,
                                            org.eclipse.persistence.internal.identitymaps.CacheKey parentCacheKey,
                                            ObjectBuildingQuery sourceQuery,
                                            org.eclipse.persistence.internal.sessions.AbstractSession executionSession,
                                            boolean isTargetProtected)
                                     throws DatabaseException
        INTERNAL: Build an aggregate object from the specified row and put it in the specified target object.
        Overrides:
        readFromRowIntoObject in class DatabaseMapping
        Throws:
        DatabaseException
      • rehashFieldDependancies

        public void rehashFieldDependancies​(org.eclipse.persistence.internal.sessions.AbstractSession session)
        INTERNAL: Rehash any hashtables based on fields. This is used to clone descriptors for aggregates, which hammer field names.
        Overrides:
        rehashFieldDependancies in class DatabaseMapping
      • requiresDataModificationEventsForMapKey

        public boolean requiresDataModificationEventsForMapKey()
        INTERNAL: Return whether this mapping requires extra queries to update the rows if it is used as a key in a map. This will typically be true if there are any parts to this mapping that are not read-only.
        Specified by:
        requiresDataModificationEventsForMapKey in interface MapKeyMapping
      • setAggregateToSourceFieldAssociations

        public void setAggregateToSourceFieldAssociations​(Vector<Association> fieldAssociations)
        INTERNAL: Set a collection of the aggregate to source field name associations.
      • setAggregateToSourceFields

        public void setAggregateToSourceFields​(Map<String,​org.eclipse.persistence.internal.helper.DatabaseField> aggregateToSource)
        INTERNAL: Set the hashtable that stores target field name to the source field name.
      • setIsNullAllowed

        public void setIsNullAllowed​(boolean isNullAllowed)
        PUBLIC: Configure if all the fields in the database row for the aggregate object are NULL, then, by default, the mapping will place a null in the appropriate source object (as opposed to an aggregate object filled with nulls). To change this behavior, set the value of this variable to false. Then the mapping will build a new instance of the aggregate object that is filled with nulls and place it in the source object. Note: Any aggregate that has a relationship mapping automatically does not allow null.
      • setTableForAggregateMappingKey

        public void setTableForAggregateMappingKey​(org.eclipse.persistence.internal.helper.DatabaseTable table)
        INTERNAL: If this mapping is used as the key of a CollectionTableMapMapping, the table used by this mapping will be the relation table. Set this table.
      • unwrapKey

        public Object unwrapKey​(Object key,
                                org.eclipse.persistence.internal.sessions.AbstractSession session)
        INTERNAL: Allow the key mapping to unwrap the object.
        Specified by:
        unwrapKey in interface MapKeyMapping
        Returns:
      • wrapKey

        public Object wrapKey​(Object key,
                              org.eclipse.persistence.internal.sessions.AbstractSession session)
        INTERNAL: Allow the key mapping to wrap the object.
        Specified by:
        wrapKey in interface MapKeyMapping
        Returns:
      • writeFromAttributeIntoRow

        public void writeFromAttributeIntoRow​(Object attribute,
                                              org.eclipse.persistence.internal.sessions.AbstractRecord row,
                                              org.eclipse.persistence.internal.sessions.AbstractSession session)
        INTERNAL: A subclass should implement this method if it wants different behavior. Write the foreign key values from the attribute to the row.
        Overrides:
        writeFromAttributeIntoRow in class DatabaseMapping
      • writeFromObjectIntoRowForShallowInsert

        public void writeFromObjectIntoRowForShallowInsert​(Object object,
                                                           org.eclipse.persistence.internal.sessions.AbstractRecord row,
                                                           org.eclipse.persistence.internal.sessions.AbstractSession session)
        INTERNAL: This row is built for shallow insert which happens in case of bidirectional inserts.
        Overrides:
        writeFromObjectIntoRowForShallowInsert in class DatabaseMapping
      • writeFromObjectIntoRowForUpdateAfterShallowInsert

        public void writeFromObjectIntoRowForUpdateAfterShallowInsert​(Object object,
                                                                      org.eclipse.persistence.internal.sessions.AbstractRecord row,
                                                                      org.eclipse.persistence.internal.sessions.AbstractSession session,
                                                                      org.eclipse.persistence.internal.helper.DatabaseTable table)
        INTERNAL: This row is built for update after shallow insert which happens in case of bidirectional inserts. It contains the foreign keys with non null values that were set to null for shallow insert.
        Overrides:
        writeFromObjectIntoRowForUpdateAfterShallowInsert in class DatabaseMapping
      • writeFromObjectIntoRowForUpdateBeforeShallowDelete

        public void writeFromObjectIntoRowForUpdateBeforeShallowDelete​(Object object,
                                                                       org.eclipse.persistence.internal.sessions.AbstractRecord row,
                                                                       org.eclipse.persistence.internal.sessions.AbstractSession session,
                                                                       org.eclipse.persistence.internal.helper.DatabaseTable table)
        INTERNAL: This row is built for update before shallow delete which happens in case of bidirectional inserts. It contains the same fields as the row built by writeFromObjectIntoRowForUpdateAfterShallowInsert, but all the values are null.
        Overrides:
        writeFromObjectIntoRowForUpdateBeforeShallowDelete in class DatabaseMapping
      • writeFromObjectIntoRowWithChangeRecord

        public void writeFromObjectIntoRowWithChangeRecord​(org.eclipse.persistence.internal.sessions.ChangeRecord changeRecord,
                                                           org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow,
                                                           org.eclipse.persistence.internal.sessions.AbstractSession session,
                                                           DatabaseMapping.WriteType writeType)
                                                    throws DescriptorException
        INTERNAL: Get the attribute value from the object and add the appropriate values to the specified database row.
        Overrides:
        writeFromObjectIntoRowWithChangeRecord in class DatabaseMapping
        Throws:
        DescriptorException
      • writeInsertFieldsIntoRow

        public void writeInsertFieldsIntoRow​(org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow,
                                             org.eclipse.persistence.internal.sessions.AbstractSession session)
        INTERNAL: Write fields needed for insert into the template for with null values.
        Overrides:
        writeInsertFieldsIntoRow in class DatabaseMapping
      • writeUpdateFieldsIntoRow

        public void writeUpdateFieldsIntoRow​(org.eclipse.persistence.internal.sessions.AbstractRecord databaseRow,
                                             org.eclipse.persistence.internal.sessions.AbstractSession session)
        Description copied from class: DatabaseMapping
        INTERNAL: Write fields needed for update into the template for with null values. By default inserted fields are used.
        Overrides:
        writeUpdateFieldsIntoRow in class DatabaseMapping
      • addPrimaryKeyJoinField

        public void addPrimaryKeyJoinField​(org.eclipse.persistence.internal.helper.DatabaseField primaryKeyField,
                                           org.eclipse.persistence.internal.helper.DatabaseField secondaryField)
        INTERNAL: Add a primary key join column (secondary field). If this contain primary keys and the descriptor(or its subclass) has multiple tables (secondary tables or joined inheritance strategy), this should also know the primary key join columns to handle some cases properly.