Class EnumUserType
- java.lang.Object
-
- org.onebusaway.container.hibernate.EnumUserType
-
- All Implemented Interfaces:
org.hibernate.usertype.EnhancedUserType,org.hibernate.usertype.ParameterizedType,org.hibernate.usertype.UserType
public class EnumUserType extends Object implements org.hibernate.usertype.EnhancedUserType, org.hibernate.usertype.ParameterizedType
A custom HibernateEnhancedUserTypefor mapping a Java enum to an SQL varchar in the database as opposed to the default behavior of an int.- Author:
- bdferris
-
-
Constructor Summary
Constructors Constructor Description EnumUserType()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Objectassemble(Serializable cached, Object owner)ObjectdeepCopy(Object value)Serializabledisassemble(Object value)booleanequals(Object x, Object y)ObjectfromXMLString(String xmlValue)inthashCode(Object x)booleanisMutable()ObjectnullSafeGet(ResultSet rs, String[] names, Object owner)ObjectnullSafeGet(ResultSet rs, String[] names, org.hibernate.engine.spi.SharedSessionContractImplementor sharedSessionContractImplementor, Object o)voidnullSafeSet(PreparedStatement st, Object value, int index)voidnullSafeSet(PreparedStatement st, Object value, int index, org.hibernate.engine.spi.SharedSessionContractImplementor sharedSessionContractImplementor)StringobjectToSQLString(Object value)Objectreplace(Object original, Object target, Object owner)ClassreturnedClass()voidsetParameterValues(Properties parameters)int[]sqlTypes()StringtoXMLString(Object value)
-
-
-
Method Detail
-
setParameterValues
public void setParameterValues(Properties parameters)
- Specified by:
setParameterValuesin interfaceorg.hibernate.usertype.ParameterizedType
-
assemble
public Object assemble(Serializable cached, Object owner) throws org.hibernate.HibernateException
- Specified by:
assemblein interfaceorg.hibernate.usertype.UserType- Throws:
org.hibernate.HibernateException
-
deepCopy
public Object deepCopy(Object value) throws org.hibernate.HibernateException
- Specified by:
deepCopyin interfaceorg.hibernate.usertype.UserType- Throws:
org.hibernate.HibernateException
-
disassemble
public Serializable disassemble(Object value) throws org.hibernate.HibernateException
- Specified by:
disassemblein interfaceorg.hibernate.usertype.UserType- Throws:
org.hibernate.HibernateException
-
equals
public boolean equals(Object x, Object y) throws org.hibernate.HibernateException
- Specified by:
equalsin interfaceorg.hibernate.usertype.UserType- Throws:
org.hibernate.HibernateException
-
hashCode
public int hashCode(Object x) throws org.hibernate.HibernateException
- Specified by:
hashCodein interfaceorg.hibernate.usertype.UserType- Throws:
org.hibernate.HibernateException
-
nullSafeGet
public Object nullSafeGet(ResultSet rs, String[] names, org.hibernate.engine.spi.SharedSessionContractImplementor sharedSessionContractImplementor, Object o) throws org.hibernate.HibernateException, SQLException
- Specified by:
nullSafeGetin interfaceorg.hibernate.usertype.UserType- Throws:
org.hibernate.HibernateExceptionSQLException
-
nullSafeSet
public void nullSafeSet(PreparedStatement st, Object value, int index, org.hibernate.engine.spi.SharedSessionContractImplementor sharedSessionContractImplementor) throws org.hibernate.HibernateException, SQLException
- Specified by:
nullSafeSetin interfaceorg.hibernate.usertype.UserType- Throws:
org.hibernate.HibernateExceptionSQLException
-
isMutable
public boolean isMutable()
- Specified by:
isMutablein interfaceorg.hibernate.usertype.UserType
-
nullSafeGet
public Object nullSafeGet(ResultSet rs, String[] names, Object owner) throws org.hibernate.HibernateException, SQLException
- Throws:
org.hibernate.HibernateExceptionSQLException
-
nullSafeSet
public void nullSafeSet(PreparedStatement st, Object value, int index) throws org.hibernate.HibernateException, SQLException
- Throws:
org.hibernate.HibernateExceptionSQLException
-
replace
public Object replace(Object original, Object target, Object owner) throws org.hibernate.HibernateException
- Specified by:
replacein interfaceorg.hibernate.usertype.UserType- Throws:
org.hibernate.HibernateException
-
returnedClass
public Class returnedClass()
- Specified by:
returnedClassin interfaceorg.hibernate.usertype.UserType
-
sqlTypes
public int[] sqlTypes()
- Specified by:
sqlTypesin interfaceorg.hibernate.usertype.UserType
-
fromXMLString
public Object fromXMLString(String xmlValue)
- Specified by:
fromXMLStringin interfaceorg.hibernate.usertype.EnhancedUserType
-
objectToSQLString
public String objectToSQLString(Object value)
- Specified by:
objectToSQLStringin interfaceorg.hibernate.usertype.EnhancedUserType
-
-