Class EnumType<T extends Enum<T>>

    • Constructor Summary

      Constructors 
      Constructor Description
      EnumType()
      Deprecated, for removal: This API element is subject to removal in a future version.
       
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      T assemble​(Serializable cached, Object owner)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Reconstruct a value from its destructured representation, during the process of reading the properties of an entity from the second-level cache.
      T deepCopy​(T value)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Return a clone of the given instance of the Java class mapped by this custom type.
      Serializable disassemble​(T value)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Transform the given value into a destructured representation, suitable for storage in the second-level cache.
      boolean equals​(T x, T y)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Compare two instances of the Java class mapped by this custom type for persistence "equality", that is, equality of their persistent state.
      T fromStringValue​(CharSequence sequence)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Consume the given string representation back into this types java form.
      Class<T> getEnumClass()
      Deprecated, for removal: This API element is subject to removal in a future version.
       
      JdbcType getJdbcType​(TypeConfiguration typeConfiguration)
      Deprecated, for removal: This API element is subject to removal in a future version.
      A mapped JdbcType.
      int getSqlType()
      Deprecated, for removal: This API element is subject to removal in a future version.
      The JDBC/SQL type code for the database column mapped by this custom type.
      TypeConfiguration getTypeConfiguration()
      Deprecated, for removal: This API element is subject to removal in a future version.
       
      int hashCode​(T x)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Get a hash code for the given instance of the Java class mapped by this custom type, consistent with the definition of persistence "equality" for this custom type.
      boolean isMutable()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Are instances of the Java class mapped by this custom type mutable or immutable?
      boolean isOrdinal()
      Deprecated, for removal: This API element is subject to removal in a future version.
       
      T nullSafeGet​(ResultSet rs, int position, SharedSessionContractImplementor session, Object owner)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Read an instance of the Java class mapped by this custom type from the given JDBC ResultSet.
      void nullSafeSet​(PreparedStatement st, T value, int index, SharedSessionContractImplementor session)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Write an instance of the Java class mapped by this custom type to the given JDBC PreparedStatement.
      T replace​(T original, T target, Object owner)
      Deprecated, for removal: This API element is subject to removal in a future version.
      During merge, replace the existing (target) value in the managed entity we are merging to with a new (original) value from the detached entity we are merging.
      Class<T> returnedClass()
      Deprecated, for removal: This API element is subject to removal in a future version.
      The class returned by nullSafeGet().
      void setParameterValues​(Properties parameters)
      Deprecated, for removal: This API element is subject to removal in a future version.
      An instance of this class is "configured" by a call to setParameterValues(java.util.Properties), where configuration parameters are given as entries in a Properties object.
      void setTypeConfiguration​(TypeConfiguration typeConfiguration)
      Deprecated, for removal: This API element is subject to removal in a future version.
       
      String toLoggableString​(Object value, SessionFactoryImplementor factory)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Generate a loggable string representation of the collection (value).
      String toSqlLiteral​(T value)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Return an SQL literal representation of the value
      String toString​(T value)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Render the value to the string representation.
    • Field Detail

      • ENUM

        public static final String ENUM
        Deprecated, for removal: This API element is subject to removal in a future version.
        See Also:
        Constant Field Values
      • NAMED

        public static final String NAMED
        Deprecated, for removal: This API element is subject to removal in a future version.
        See Also:
        Constant Field Values
      • TYPE

        public static final String TYPE
        Deprecated, for removal: This API element is subject to removal in a future version.
        See Also:
        Constant Field Values
    • Constructor Detail

      • EnumType

        public EnumType()
        Deprecated, for removal: This API element is subject to removal in a future version.
    • Method Detail

      • getEnumClass

        public Class<T> getEnumClass()
        Deprecated, for removal: This API element is subject to removal in a future version.
      • getSqlType

        public int getSqlType()
        Deprecated, for removal: This API element is subject to removal in a future version.
        Description copied from interface: UserType
        The JDBC/SQL type code for the database column mapped by this custom type.

        The type code is usually one of the standard type codes declared by SqlTypes, but it could be a database-specific code.

        Specified by:
        getSqlType in interface UserType<T extends Enum<T>>
        See Also:
        SqlTypes
      • returnedClass

        public Class<T> returnedClass()
        Deprecated, for removal: This API element is subject to removal in a future version.
        Description copied from interface: UserType
        The class returned by nullSafeGet().
        Specified by:
        returnedClass in interface UserType<T extends Enum<T>>
        Returns:
        Class
      • equals

        public boolean equals​(T x,
                              T y)
                       throws HibernateException
        Deprecated, for removal: This API element is subject to removal in a future version.
        Description copied from interface: UserType
        Compare two instances of the Java class mapped by this custom type for persistence "equality", that is, equality of their persistent state.
        Specified by:
        equals in interface UserType<T extends Enum<T>>
        Throws:
        HibernateException
      • hashCode

        public int hashCode​(T x)
                     throws HibernateException
        Deprecated, for removal: This API element is subject to removal in a future version.
        Description copied from interface: UserType
        Get a hash code for the given instance of the Java class mapped by this custom type, consistent with the definition of persistence "equality" for this custom type.
        Specified by:
        hashCode in interface UserType<T extends Enum<T>>
        Throws:
        HibernateException
      • deepCopy

        public T deepCopy​(T value)
                   throws HibernateException
        Deprecated, for removal: This API element is subject to removal in a future version.
        Description copied from interface: UserType
        Return a clone of the given instance of the Java class mapped by this custom type.
        • It's not necessary to clone immutable objects. If the Java class mapped by this custom type is an immutable class, this method may safely just return its argument.
        • For mutable objects, it's necessary to deep copy persistent state, stopping at associations to other entities, and at persistent collections.
        • If the argument is a reference to an entity, just return the argument.
        • Finally, if the argument is null, just return null.
        Specified by:
        deepCopy in interface UserType<T extends Enum<T>>
        Parameters:
        value - the object to be cloned, which may be null
        Returns:
        a clone
        Throws:
        HibernateException
      • isMutable

        public boolean isMutable()
        Deprecated, for removal: This API element is subject to removal in a future version.
        Description copied from interface: UserType
        Are instances of the Java class mapped by this custom type mutable or immutable?
        Specified by:
        isMutable in interface UserType<T extends Enum<T>>
        Returns:
        true if instances are mutable
      • disassemble

        public Serializable disassemble​(T value)
                                 throws HibernateException
        Deprecated, for removal: This API element is subject to removal in a future version.
        Description copied from interface: UserType
        Transform the given value into a destructured representation, suitable for storage in the second-level cache. This method is called only during the process of writing the properties of an entity to the second-level cache.

        If the value is mutable then, at the very least, this method should perform a deep copy. That may not be enough for some types, however. For example, associations must be cached as identifier values.

        This is an optional operation, but, if left unimplemented, this type will not be cacheable in the second-level cache.

        Specified by:
        disassemble in interface UserType<T extends Enum<T>>
        Parameters:
        value - the object to be cached
        Returns:
        a cacheable representation of the object
        Throws:
        HibernateException
        See Also:
        Cache
      • assemble

        public T assemble​(Serializable cached,
                          Object owner)
                   throws HibernateException
        Deprecated, for removal: This API element is subject to removal in a future version.
        Description copied from interface: UserType
        Reconstruct a value from its destructured representation, during the process of reading the properties of an entity from the second-level cache.

        If the value is mutable then, at the very least, this method should perform a deep copy. That may not be enough for some types, however. For example, associations must be cached as identifier values.

        This is an optional operation, but, if left unimplemented, this type will not be cacheable in the second-level cache.

        Specified by:
        assemble in interface UserType<T extends Enum<T>>
        Parameters:
        cached - the object to be cached
        owner - the owner of the cached object
        Returns:
        a reconstructed object from the cacheable representation
        Throws:
        HibernateException
        See Also:
        Cache
      • replace

        public T replace​(T original,
                         T target,
                         Object owner)
                  throws HibernateException
        Deprecated, for removal: This API element is subject to removal in a future version.
        Description copied from interface: UserType
        During merge, replace the existing (target) value in the managed entity we are merging to with a new (original) value from the detached entity we are merging.
        • For immutable objects, or null values, it's safe to simply return the first argument.
        • For mutable objects, it's enough to return a copy of the first argument.
        • For objects with component values, it might make sense to recursively replace component values.
        Specified by:
        replace in interface UserType<T extends Enum<T>>
        Parameters:
        original - the value from the detached entity being merged
        target - the value in the managed entity
        Returns:
        the value to be merged
        Throws:
        HibernateException
        See Also:
        Session.merge(Object)
      • toSqlLiteral

        public String toSqlLiteral​(T value)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Description copied from interface: EnhancedUserType
        Return an SQL literal representation of the value
        Specified by:
        toSqlLiteral in interface EnhancedUserType<T extends Enum<T>>
      • toString

        public String toString​(T value)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Description copied from interface: EnhancedUserType
        Render the value to the string representation.
        Specified by:
        toString in interface EnhancedUserType<T extends Enum<T>>
        Parameters:
        value - The value to render to string.
        Returns:
        The string representation
      • fromStringValue

        public T fromStringValue​(CharSequence sequence)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Description copied from interface: EnhancedUserType
        Consume the given string representation back into this types java form.
        Specified by:
        fromStringValue in interface EnhancedUserType<T extends Enum<T>>
        Parameters:
        sequence - The string representation to be consumed.
        Returns:
        The java type representation
      • toLoggableString

        public String toLoggableString​(Object value,
                                       SessionFactoryImplementor factory)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Description copied from interface: LoggableUserType
        Generate a loggable string representation of the collection (value).
        Specified by:
        toLoggableString in interface LoggableUserType
        Parameters:
        value - The collection to be logged; guaranteed to be non-null and initialized.
        factory - The factory.
        Returns:
        The loggable string representation.
      • isOrdinal

        public boolean isOrdinal()
        Deprecated, for removal: This API element is subject to removal in a future version.