Class PostgreSQLEnumType

  • All Implemented Interfaces:
    java.io.Serializable, org.hibernate.type.spi.TypeConfigurationAware, org.hibernate.usertype.DynamicParameterizedType, org.hibernate.usertype.EnhancedUserType, org.hibernate.usertype.LoggableUserType, org.hibernate.usertype.ParameterizedType, org.hibernate.usertype.UserType

    public class PostgreSQLEnumType
    extends org.hibernate.type.EnumType
    Maps an Enum to a PostgreSQL ENUM column type.

    For more details about how to use it, check out this article on vladmihalcea.com.

    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface org.hibernate.usertype.DynamicParameterizedType

        org.hibernate.usertype.DynamicParameterizedType.ParameterType
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private Configuration configuration  
      static PostgreSQLEnumType INSTANCE  
      • Fields inherited from class org.hibernate.type.EnumType

        ENUM, NAMED, TYPE
      • Fields inherited from interface org.hibernate.usertype.DynamicParameterizedType

        ACCESS_TYPE, ENTITY, IS_DYNAMIC, IS_PRIMARY_KEY, PARAMETER_TYPE, PROPERTY, RETURNED_CLASS, XPROPERTY
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void nullSafeSet​(java.sql.PreparedStatement st, java.lang.Object value, int index, org.hibernate.engine.spi.SharedSessionContractImplementor session)  
      int[] sqlTypes()  
      • Methods inherited from class org.hibernate.type.EnumType

        assemble, deepCopy, disassemble, equals, fromXMLString, getTypeConfiguration, hashCode, isMutable, isOrdinal, nullSafeGet, objectToSQLString, replace, returnedClass, setParameterValues, setTypeConfiguration, toLoggableString, toXMLString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PostgreSQLEnumType

        public PostgreSQLEnumType()
        Initialization constructor taking the default Configuration object.
      • PostgreSQLEnumType

        public PostgreSQLEnumType​(Configuration configuration)
        Initialization constructor taking a custom Configuration object.
        Parameters:
        configuration - custom Configuration object.
      • PostgreSQLEnumType

        public PostgreSQLEnumType​(java.lang.Class<? extends java.lang.Enum> enumClass)
        Initialization constructor taking the Class.
        Parameters:
        enumClass - The enum type
    • Method Detail

      • nullSafeSet

        public void nullSafeSet​(java.sql.PreparedStatement st,
                                java.lang.Object value,
                                int index,
                                org.hibernate.engine.spi.SharedSessionContractImplementor session)
                         throws org.hibernate.HibernateException,
                                java.sql.SQLException
        Specified by:
        nullSafeSet in interface org.hibernate.usertype.UserType
        Overrides:
        nullSafeSet in class org.hibernate.type.EnumType
        Throws:
        org.hibernate.HibernateException
        java.sql.SQLException
      • sqlTypes

        public int[] sqlTypes()
        Specified by:
        sqlTypes in interface org.hibernate.usertype.UserType
        Overrides:
        sqlTypes in class org.hibernate.type.EnumType