Class PostgreSQLEnumType
- java.lang.Object
-
- org.hibernate.type.EnumType
-
- com.vladmihalcea.hibernate.type.basic.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 anEnum
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
-
-
Field Summary
Fields Modifier and Type Field Description private Configuration
configuration
static PostgreSQLEnumType
INSTANCE
-
Constructor Summary
Constructors Constructor Description PostgreSQLEnumType()
Initialization constructor taking the defaultConfiguration
object.PostgreSQLEnumType(Configuration configuration)
Initialization constructor taking a customConfiguration
object.PostgreSQLEnumType(java.lang.Class<? extends java.lang.Enum> enumClass)
Initialization constructor taking theClass
.
-
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()
-
-
-
Field Detail
-
INSTANCE
public static final PostgreSQLEnumType INSTANCE
-
configuration
private final Configuration configuration
-
-
Constructor Detail
-
PostgreSQLEnumType
public PostgreSQLEnumType()
Initialization constructor taking the defaultConfiguration
object.
-
PostgreSQLEnumType
public PostgreSQLEnumType(Configuration configuration)
Initialization constructor taking a customConfiguration
object.- Parameters:
configuration
- customConfiguration
object.
-
PostgreSQLEnumType
public PostgreSQLEnumType(java.lang.Class<? extends java.lang.Enum> enumClass)
Initialization constructor taking theClass
.- 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 interfaceorg.hibernate.usertype.UserType
- Overrides:
nullSafeSet
in classorg.hibernate.type.EnumType
- Throws:
org.hibernate.HibernateException
java.sql.SQLException
-
sqlTypes
public int[] sqlTypes()
- Specified by:
sqlTypes
in interfaceorg.hibernate.usertype.UserType
- Overrides:
sqlTypes
in classorg.hibernate.type.EnumType
-
-