Class AbstractCompositeDirectCollectionMapping

    • Field Detail

      • field

        protected DatabaseField field
        This is the field holding the nested collection.
      • elementDataTypeName

        protected String elementDataTypeName
        This is the "data type" associated with each element in the nested collection. Depending on the data store, this could be optional.
      • valueConverter

        protected Converter valueConverter
        Allows user defined conversion between the object value and the database value.
    • Constructor Detail

      • AbstractCompositeDirectCollectionMapping

        public AbstractCompositeDirectCollectionMapping()
        Default constructor.
    • Method Detail

      • getValueConverter

        public Converter getValueConverter()
        PUBLIC: Return the converter on the mapping. A converter can be used to convert between the direct collection's object value and database value.
      • hasValueConverter

        public boolean hasValueConverter()
        PUBLIC: Indicates if there is a converter on the mapping.
      • setValueConverter

        public void setValueConverter​(Converter valueConverter)
        PUBLIC: Set the converter on the mapping. A converter can be used to convert between the direct collection's object value and database value.
      • buildBackupClone

        public void buildBackupClone​(Object clone,
                                     Object backup,
                                     UnitOfWorkImpl unitOfWork)
        INTERNAL: Clone the attribute from the clone and assign it to the backup. For these mappings, this is the same as building the first clone.
        Specified by:
        buildBackupClone in class DatabaseMapping
      • buildClonePart

        protected Object buildClonePart​(Object attributeValue,
                                        CacheKey parentCacheKey,
                                        AbstractSession cloningSession)
        Build and return a clone of the specified attribute value.
      • 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.
        Overrides:
        buildCopy in class DatabaseMapping
      • buildElementFromChangeSet

        protected Object buildElementFromChangeSet​(Object changeSet,
                                                   MergeManager mergeManager,
                                                   AbstractSession targetSession)
        Build and return a new element based on the change set. Direct collections simply store the element itself, since it is immutable.
      • getAttributeElementClass

        public Class getAttributeElementClass()
        PUBLIC: Return the class each element in the object's collection should be converted to, before the collection is inserted into the object. This is optional - if left null, the elements will be added to the object's collection unconverted.
      • getFieldElementClass

        public Class getFieldElementClass()
        PUBLIC: Return the class each element in the database row's collection should be converted to, before the collection is inserted into the database. This is optional - if left null, the elements will be added to the database row's collection unconverted.
      • getFieldName

        public String getFieldName()
        PUBLIC: Return the name of the field that holds the nested collection.
      • mapKeyHasChanged

        public boolean mapKeyHasChanged​(Object element,
                                        AbstractSession session)
        INTERNAL: Return whether the element's user-defined Map key has changed since it was cloned from the original version. Direct elements are not allowed to have keys.
        Specified by:
        mapKeyHasChanged in interface ArrayCollectionMapping
      • setAttributeElementClass

        public void setAttributeElementClass​(Class attributeElementClass)
        PUBLIC: Set the class each element in the object's collection should be converted to, before the collection is inserted into the object. This is optional - if left null, the elements will be added to the object's collection unconverted.
      • setAttributeElementClassName

        public void setAttributeElementClassName​(String attributeElementClass)
        PUBLIC: Set the class each element in the object's collection should be converted to, before the collection is inserted into the object. This is optional - if left null, the elements will be added to the object's collection unconverted.
      • setField

        public void setField​(DatabaseField field)
        Set the field that holds the nested collection.
      • setFieldElementClass

        public void setFieldElementClass​(Class fieldElementClass)
        PUBLIC: Set the class each element in the database row's collection should be converted to, before the collection is inserted into the database. This is optional - if left null, the elements will be added to the database row's collection unconverted.
      • useCollectionClass

        public void useCollectionClass​(Class concreteClass)
        PUBLIC: Configure the mapping to use an instance of the specified container class to hold the nested objects.

        jdk1.2.x: The container class must implement (directly or indirectly) the Collection interface.

        jdk1.1.x: The container class must be a subclass of Vector.

        Specified by:
        useCollectionClass in interface ContainerMapping
      • useCollectionClassName

        public void useCollectionClassName​(String concreteClassName)
        INTERNAL: Used to set the collection class by name. This is required when building from metadata to allow the correct class loader to be used.
        Specified by:
        useCollectionClassName in interface ContainerMapping
      • useListClassName

        public void useListClassName​(String concreteClassName)
        INTERNAL: Used to set the collection class by name. This is required when building from metadata to allow the correct class loader to be used.
        Specified by:
        useListClassName in interface ContainerMapping
      • useMapClass

        public void useMapClass​(Class concreteClass,
                                String methodName)
        PUBLIC: Mapping does not support Map containers. It supports only Collection containers.
        Specified by:
        useMapClass in interface ContainerMapping
      • useMapClassName

        public void useMapClassName​(String concreteContainerClassName,
                                    String methodName)
        Description copied from interface: ContainerMapping
        PUBLIC: Configure the mapping to use an instance of the specified container class to hold the target objects. The key used to index a value in the Map is the value returned by a call to the specified zero-argument method. The method must be implemented by the class (or a superclass) of any value to be inserted into the Map.

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

        To facilitate resolving the method, the mapping's referenceClass must set before calling this method.

        Specified by:
        useMapClassName in interface ContainerMapping
      • setUsesSingleNode

        public void setUsesSingleNode​(boolean usesSingleNode)
        PUBLIC: Sets whether the mapping uses a single node.
        Parameters:
        usesSingleNode - true if the items in the collection are in a single node or false if each of the items in the collection is in its own node
      • usesSingleNode

        public boolean usesSingleNode()
        PUBLIC: Checks whether the mapping uses a single node.
        Returns:
        True if the items in the collection are in a single node or false if each of the items in the collection is in its own node.
      • getFieldClassification

        public Class getFieldClassification​(DatabaseField fieldToClassify)
        INTERNAL: Return the classifiction for the field contained in the mapping. This is used to convert the row value to a consistent java value. By default this is unknown.
        Overrides:
        getFieldClassification in class DatabaseMapping
      • convertClassNamesToClasses

        public void convertClassNamesToClasses​(ClassLoader classLoader)
        Description copied from class: DatabaseMapping
        INTERNAL: Convert all the class-name-based settings in this mapping to actual class-based settings This method is implemented by subclasses as necessary.
        Overrides:
        convertClassNamesToClasses in class DatabaseMapping