org.itracker.persistence.dao
Class EnumNameUserType

java.lang.Object
  extended by org.itracker.persistence.dao.AbstractEnumUserType
      extended by org.itracker.persistence.dao.EnumNameUserType
All Implemented Interfaces:
org.hibernate.usertype.EnhancedUserType, org.hibernate.usertype.ParameterizedType, org.hibernate.usertype.UserType

public class EnumNameUserType
extends AbstractEnumUserType

Custom Hibernate UserType to persist a Java 5 enum constant as a VARCHAR using its name.

Based on the original class by Gavin King (http://www.hibernate.org/272.html).

Author:
johnny

Field Summary
 
Fields inherited from class org.itracker.persistence.dao.AbstractEnumUserType
enumClass
 
Constructor Summary
EnumNameUserType()
          Default constructor, required by Hibernate.
 
Method Summary
 Object fromXMLString(String xmlValue)
           
 Object nullSafeGet(ResultSet rs, String[] names, Object owner)
           
 void nullSafeSet(PreparedStatement st, Object value, int index)
           
 String objectToSQLString(Object value)
           
 int[] sqlTypes()
           
 String toXMLString(Object value)
           
 
Methods inherited from class org.itracker.persistence.dao.AbstractEnumUserType
assemble, deepCopy, disassemble, equals, hashCode, isMutable, replace, returnedClass, setParameterValues
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EnumNameUserType

public EnumNameUserType()
Default constructor, required by Hibernate.

Method Detail

nullSafeGet

public Object nullSafeGet(ResultSet rs,
                          String[] names,
                          Object owner)
                   throws org.hibernate.HibernateException,
                          SQLException
Throws:
org.hibernate.HibernateException
SQLException

nullSafeSet

public void nullSafeSet(PreparedStatement st,
                        Object value,
                        int index)
                 throws org.hibernate.HibernateException,
                        SQLException
Throws:
org.hibernate.HibernateException
SQLException

sqlTypes

public int[] sqlTypes()

objectToSQLString

public String objectToSQLString(Object value)

toXMLString

public String toXMLString(Object value)

fromXMLString

public Object fromXMLString(String xmlValue)


Copyright © 2002-2012 itracker. All Rights Reserved.