Class UserComponentType<T>

    • Constructor Detail

      • UserComponentType

        public UserComponentType​(Component component,
                                 int[] originalPropertyOrder,
                                 CompositeUserType<T> compositeUserType)
    • Method Detail

      • isEqual

        public boolean isEqual​(Object x,
                               Object y)
                        throws HibernateException
        Description copied from interface: Type
        Compare two instances of the class mapped by this type for persistence "equality", that is, equality of persistent state. For most types this could simply delegate to equals().

        This should always equate to some form of comparison of the value's internal state. As an example, for Java's Date class, the comparison should be of its internal state, but based only on the specific part which is persistent (the timestamp, date, or time).

        Specified by:
        isEqual in interface Type
        Overrides:
        isEqual in class ComponentType
        Parameters:
        x - The first value
        y - The second value
        Returns:
        True if there are considered equal (see discussion above).
        Throws:
        HibernateException - A problem occurred performing the comparison
      • isEqual

        public boolean isEqual​(Object x,
                               Object y,
                               SessionFactoryImplementor factory)
                        throws HibernateException
        Description copied from interface: Type
        Compare two instances of the class mapped by this type for persistence "equality", that is, equality of persistent state. For most types this could simply delegate to Type.isEqual(Object, Object).

        This should always equate to some form of comparison of the value's internal state. As an example, for Java's Date class, the comparison should be of its internal state, but based only on the specific part which is persistent (the timestamp, date, or time).

        Specified by:
        isEqual in interface Type
        Overrides:
        isEqual in class ComponentType
        Parameters:
        x - The first value
        y - The second value
        factory - The session factory
        Returns:
        True if there are considered equal (see discussion above).
        Throws:
        HibernateException - A problem occurred performing the comparison
      • getHashCode

        public int getHashCode​(Object x)
        Description copied from interface: Type
        Get a hash code, consistent with persistence "equality". For most types this could simply delegate to the given value's hashCode.
        Specified by:
        getHashCode in interface Type
        Overrides:
        getHashCode in class ComponentType
        Parameters:
        x - The value for which to retrieve a hash code
        Returns:
        The hash code
      • deepCopy

        public Object deepCopy​(Object component,
                               SessionFactoryImplementor factory)
        Description copied from interface: Type
        Return a deep copy of the persistent state, stopping at entities and at collections.
        Specified by:
        deepCopy in interface Type
        Overrides:
        deepCopy in class ComponentType
        Parameters:
        component - The value to be copied
        factory - The session factory
        Returns:
        The deep copy
      • replace

        public Object replace​(Object original,
                              Object target,
                              SharedSessionContractImplementor session,
                              Object owner,
                              Map<Object,​Object> copyCache)
        Description copied from interface: Type
        During merge, replace the existing (target) value in the entity we are merging to with a new (original) value from the detached entity we are merging. For immutable objects, or null values, it is safe to simply return the first parameter. For mutable objects, it is safe to return a copy of the first parameter. For objects with component values, it might make sense to recursively replace component values.
        Specified by:
        replace in interface Type
        Overrides:
        replace in class ComponentType
        Parameters:
        original - the value from the detached entity being merged
        target - the value in the managed entity
        session - The originating session
        owner - The owner of the value
        copyCache - The cache of already copied/replaced values
        Returns:
        the value to be merged
      • replace

        public Object replace​(Object original,
                              Object target,
                              SharedSessionContractImplementor session,
                              Object owner,
                              Map<Object,​Object> copyCache,
                              ForeignKeyDirection foreignKeyDirection)
        Description copied from interface: Type
        During merge, replace the existing (target) value in the entity we are merging to with a new (original) value from the detached entity we are merging. For immutable objects, or null values, it is safe to simply return the first parameter. For mutable objects, it is safe to return a copy of the first parameter. For objects with component values, it might make sense to recursively replace component values.
        Specified by:
        replace in interface Type
        Overrides:
        replace in class ComponentType
        Parameters:
        original - the value from the detached entity being merged
        target - the value in the managed entity
        session - The originating session
        owner - The owner of the value
        copyCache - The cache of already copied/replaced values
        foreignKeyDirection - For associations, which direction does the foreign key point?
        Returns:
        the value to be merged
      • disassemble

        public Serializable disassemble​(Object value,
                                        SharedSessionContractImplementor session,
                                        Object owner)
                                 throws HibernateException
        Description copied from interface: Type
        Return a disassembled representation of the object. This is the representation that is stored in the second-level cache.

        A reference to an associated entity should be disassembled to its primary key value.

        Specified by:
        disassemble in interface Type
        Overrides:
        disassemble in class ComponentType
        Parameters:
        value - the value to cache
        session - the originating session
        owner - optional parent entity object (needed for collections)
        Returns:
        the disassembled, deep cloned state
        Throws:
        HibernateException - An error from Hibernate