Interface MapKeyMapping

    • Method Detail

      • addAdditionalFieldsToQuery

        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
      • addFieldsForMapKey

        void addFieldsForMapKey​(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
      • addKeyToDeletedObjectsList

        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
        Parameters:
        object -
        deletedObjects -
      • buildElementClone

        Object buildElementClone​(Object element,
                                 Object parent,
                                 CacheKey cacheKey,
                                 Integer refreshCascade,
                                 AbstractSession cloningSession,
                                 boolean isExisting,
                                 boolean isFromSharedCache)
        Build a clone of the given element in a unitOfWork
        Parameters:
        element -
        cloningSession -
        isExisting -
        Returns:
      • buildSelectionQueryForDirectCollectionKeyMapping

        ReadQuery buildSelectionQueryForDirectCollectionKeyMapping​(ContainerPolicy containerPolicy)
        INTERNAL: Depending on the MapKeyMapping, a different selection query may be required to retrieve the map when the map is based on a DirectCollectionMapping
        Returns:
      • cascadeDiscoverAndPersistUnregisteredNewObjects

        void cascadeDiscoverAndPersistUnregisteredNewObjects​(Object object,
                                                             Map newObjects,
                                                             Map unregisteredExistingObjects,
                                                             Map visitedObjects,
                                                             UnitOfWorkImpl uow,
                                                             boolean getAttributeValueFromObject,
                                                             Set cascadeErrors)
        INTERNAL: Cascade discover and persist new objects during commit to the map key
      • cascadePerformRemoveIfRequired

        void cascadePerformRemoveIfRequired​(Object object,
                                            UnitOfWorkImpl uow,
                                            Map visitedObjects,
                                            boolean getAttributeValueFromObject)
        INTERNAL: Cascade perform delete through mappings that require the cascade
      • cascadeRegisterNewIfRequired

        void cascadeRegisterNewIfRequired​(Object object,
                                          UnitOfWorkImpl uow,
                                          Map visitedObjects,
                                          boolean getAttributeValueFromObject)
        INTERNAL: Cascade registerNew for Create through mappings that require the cascade
      • createQueryKeyForMapKey

        QueryKey createQueryKeyForMapKey()
        INTERNAL: Create a query key that links to the map key
        Returns:
      • createSerializableMapKeyInfo

        Object createSerializableMapKeyInfo​(Object key,
                                            AbstractSession session)
        INTERNAL: Creates the Array of simple types used to recreate this map.
      • createMapComponentsFromSerializableKeyInfo

        List<Object> createMapComponentsFromSerializableKeyInfo​(Object[] keyInfo,
                                                                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.
      • createStubbedMapComponentFromSerializableKeyInfo

        Object createStubbedMapComponentFromSerializableKeyInfo​(Object keyInfo,
                                                                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.
      • deleteMapKey

        void deleteMapKey​(Object objectDeleted,
                          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
        Parameters:
        objectDeleted -
        session -
      • getAdditionalTablesForJoinQuery

        List<DatabaseTable> getAdditionalTablesForJoinQuery()
        INTERNAL: Return any tables that will be required when this mapping is used as part of a join query
        Returns:
      • getAllFieldsForMapKey

        List<DatabaseField> getAllFieldsForMapKey()
        INTERNAL: Get all the fields for the map key
      • getForeignKeyFieldsForMapKey

        Map<DatabaseField,​DatabaseField> getForeignKeyFieldsForMapKey()
        INTERNAL: Return a Map of any foreign keys defined within the the MapKey
        Returns:
      • getReferenceDescriptor

        ClassDescriptor getReferenceDescriptor()
        INTERNAL: Get the descriptor for the Map Key
        Returns:
      • getIdentityFieldsForMapKey

        List<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
        Returns:
      • getAdditionalSelectionCriteriaForMapKey

        Expression getAdditionalSelectionCriteriaForMapKey()
        INTERNAL: Return the selection criteria necessary to select the target object
        Returns:
      • getTargetVersionOfSourceObject

        Object getTargetVersionOfSourceObject​(Object object,
                                              Object parent,
                                              MergeManager mergeManager,
                                              AbstractSession targetSession)
        INTERNAL: If required, get the targetVersion of the source object from the merge manager
        Returns:
      • getMapKeyTargetType

        Object getMapKeyTargetType()
        INTERNAL: Return the class this key mapping maps or the descriptor for it
        Returns:
      • iterateOnMapKey

        void iterateOnMapKey​(DescriptorIterator iterator,
                             Object element)
        INTERNAL: Called when iterating through descriptors to handle iteration on this mapping when it is used as a MapKey
        Parameters:
        iterator -
        element -
      • extractIdentityFieldsForQuery

        Map extractIdentityFieldsForQuery​(Object key,
                                          AbstractSession session)
        INTERNAL: Extract the fields for the Map key from the object to use in a query
        Returns:
      • requiresDataModificationEventsForMapKey

        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.
      • unwrapKey

        Object unwrapKey​(Object key,
                         AbstractSession session)
        INTERNAL: Allow the key mapping to unwrap the object
        Parameters:
        key -
        session -
        Returns:
      • wrapKey

        Object wrapKey​(Object key,
                       AbstractSession session)
        INTERNAL: Allow the key mapping to wrap the object
        Parameters:
        key -
        session -
        Returns: