Class DirectMapMapping

    • Constructor Detail

      • DirectMapMapping

        public DirectMapMapping()
        DirectMapCollectionMapping constructor
    • Method Detail

      • getKeyConverter

        public Converter getKeyConverter()
        PUBLIC: Return the converter on the mapping. A converter can be used to convert between the key's object value and database value.
      • setKeyConverter

        public void setKeyConverter​(Converter keyConverter)
        PUBLIC: Set the converter on the mapping. A converter can be used to convert between the key's object value and database value.
      • setKeyConverterClassName

        public void setKeyConverterClassName​(String keyConverterClassName)
        INTERNAL: Set the converter class name on the mapping. Initialized in convertClassNamesToClasses. A converter can be used to convert between the key's object value and database value.
      • addToCollectionChangeRecord

        public void addToCollectionChangeRecord​(Object newKey,
                                                Object newValue,
                                                ObjectChangeSet objectChangeSet,
                                                UnitOfWorkImpl uow)
                                         throws DescriptorException
        INTERNAL: Add a new value and its change set to the collection change record. This is used by attribute change tracking. If a value has changed then issue a remove first with the key then an add.
        Throws:
        DescriptorException
      • 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.
        Overrides:
        buildCloneForPartObject in class CollectionMapping
        Parameters:
        attributeValue - TODO
        original - TODO
        cacheKey - TODO
        clone - TODO
        cloningSession - TODO
        refreshCascade - TODO
        isExisting - TODO
        isFromSharedCache - TODO
        Returns:
        TODO
      • calculateDeferredChanges

        public void calculateDeferredChanges​(ChangeRecord changeRecord,
                                             AbstractSession session)
        INTERNAL: Used by AttributeLevelChangeTracking to update a changeRecord with calculated changes as opposed to detected changes. If an attribute can not be change tracked it's changes can be detected through this process.
        Overrides:
        calculateDeferredChanges in class DirectCollectionMapping
        Parameters:
        changeRecord - TODO
        session - TODO
      • 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 class DirectCollectionMapping
        Parameters:
        object - TODO
        newObjects - TODO
        unregisteredExistingObjects - TODO
        visitedObjects - TODO
        uow - TODO
        cascadeErrors - TODO
      • compareObjects

        public boolean compareObjects​(Object firstObject,
                                      Object secondObject,
                                      AbstractSession session)
        INTERNAL: Compare the attributes belonging to this mapping for the objects.
        Overrides:
        compareObjects in class DirectCollectionMapping
        Parameters:
        firstObject - TODO
        secondObject - TODO
        session - TODO
        Returns:
        TODO
      • getDirectKeyField

        public DatabaseField getDirectKeyField()
        INTERNAL:
      • isDirectMapMapping

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

        public void setDirectKeyField​(DatabaseField keyField)
        INTERNAL:
      • setDirectKeyFieldClassification

        public void setDirectKeyFieldClassification​(Class<?> fieldType)
        ADVANCED: Set the class type of the field value. This can be used if field value differs from the object value, has specific typing requirements such as usage of java.sql.Blob or NChar. This must be called after the field name has been set.
      • setDirectKeyFieldClassificationName

        public void setDirectKeyFieldClassificationName​(String fieldTypeName)
        ADVANCED: Set the class type name of the field value. This can be used if field value differs from the object value, has specific typing requirements such as usage of java.sql.Blob or NChar. This must be called after the direct key field has been set.
      • setDirectKeyFieldName

        public void setDirectKeyFieldName​(String fieldName)
        PUBLIC: Set the direct key field name in the reference table. This is the field that the primitive data value of the Map key is stored in.
      • useMapClass

        public void useMapClass​(Class<?> concreteClass)
        PUBLIC: Configure the mapping to use an instance of the specified container class to hold the target objects.

        The default container class is java.util.Hashtable.

        The container class must implements (directly or indirectly) the Map interface.

        Note: Do not use both useMapClass(Class concreteClass), useTransparentMap(). The last use of one of the two methods will override the previous one.

        Overrides:
        useMapClass in class CollectionMapping
      • useTransparentMap

        public void useTransparentMap()
        PUBLIC: Configure the mapping to use an instance of the specified container class to hold the target objects.

        The container class must implement (directly or indirectly) the Map interface.

        Note: Do not use both useMapClass(Class concreteClass), useTransparentMap(). The last use of one of the two methods will override the previous one.

      • setKeyClass

        public void setKeyClass​(Class<?> keyClass)
        PUBLIC: This is a helper method to set the key converter to a TypeConversionConverter. This ensures that the key value from the database is converted to the correct Java type. The converter can also be set directly. Note that setting the converter to another converter will overwrite this setting.
      • getKeyClass

        public Class<?> getKeyClass()
        PUBLIC: This is a helper method to get the object class from the key converter if it is a TypeConversionConverter. This returns null if not using a TypeConversionConverter key converter.
      • setValueClass

        public void setValueClass​(Class<?> valueClass)
        PUBLIC: This is a helper method to set the value converter to a TypeConversionConverter. This ensures that the value from the database is converted to the correct Java type. The converter can also be set directly. Note that setting the converter to another converter will overwrite this setting.
      • getValueClass

        public Class<?> getValueClass()
        PUBLIC: This is a helper method to get the object class from the value converter if it is a TypeConversionConverter. This returns null if not using a TypeConversionConverter value converter.