Class EnumStringType

java.lang.Object
org.openxava.types.EnumStringType
All Implemented Interfaces:
org.hibernate.usertype.ParameterizedType, org.hibernate.usertype.UserType

public class EnumStringType extends Object implements org.hibernate.usertype.UserType, org.hibernate.usertype.ParameterizedType
In java an Enum and in database a String corresponding to the position in the string that it's in property 'strings'.

Example of use:

Author:
David Buedo
  • Constructor Details

    • EnumStringType

      public EnumStringType()
  • Method Details

    • sqlTypes

      public int[] sqlTypes()
      Specified by:
      sqlTypes in interface org.hibernate.usertype.UserType
    • returnedClass

      public Class returnedClass()
      Specified by:
      returnedClass in interface org.hibernate.usertype.UserType
    • equals

      public boolean equals(Object obj1, Object obj2) throws org.hibernate.HibernateException
      Specified by:
      equals in interface org.hibernate.usertype.UserType
      Throws:
      org.hibernate.HibernateException
    • hashCode

      public int hashCode(Object obj) throws org.hibernate.HibernateException
      Specified by:
      hashCode in interface org.hibernate.usertype.UserType
      Throws:
      org.hibernate.HibernateException
    • nullSafeGet

      public Object nullSafeGet(ResultSet resultSet, String[] names, org.hibernate.engine.spi.SharedSessionContractImplementor sessionImplementor, Object owner) throws org.hibernate.HibernateException, SQLException
      Specified by:
      nullSafeGet in interface org.hibernate.usertype.UserType
      Throws:
      org.hibernate.HibernateException
      SQLException
    • nullSafeSet

      public void nullSafeSet(PreparedStatement ps, Object value, int index, org.hibernate.engine.spi.SharedSessionContractImplementor sessionImplementor) throws org.hibernate.HibernateException, SQLException
      Specified by:
      nullSafeSet in interface org.hibernate.usertype.UserType
      Throws:
      org.hibernate.HibernateException
      SQLException
    • setParameterValues

      public void setParameterValues(Properties parameters)
      Specified by:
      setParameterValues in interface org.hibernate.usertype.ParameterizedType
    • deepCopy

      public Object deepCopy(Object obj) throws org.hibernate.HibernateException
      Specified by:
      deepCopy in interface org.hibernate.usertype.UserType
      Throws:
      org.hibernate.HibernateException
    • isMutable

      public boolean isMutable()
      Specified by:
      isMutable in interface org.hibernate.usertype.UserType
    • disassemble

      public Serializable disassemble(Object obj) throws org.hibernate.HibernateException
      Specified by:
      disassemble in interface org.hibernate.usertype.UserType
      Throws:
      org.hibernate.HibernateException
    • assemble

      public Object assemble(Serializable cached, Object owner) throws org.hibernate.HibernateException
      Specified by:
      assemble in interface org.hibernate.usertype.UserType
      Throws:
      org.hibernate.HibernateException
    • replace

      public Object replace(Object original, Object target, Object owner) throws org.hibernate.HibernateException
      Specified by:
      replace in interface org.hibernate.usertype.UserType
      Throws:
      org.hibernate.HibernateException
    • getEnumType

      public String getEnumType()
      Full qualified class for the Enum. <p> For example: "model.EntityName$EnumName"
    • setEnumType

      public void setEnumType(String enumType)
      Full qualified class for the Enum. <p> For example: "model.EntityName$EnumName"
    • getStrings

      public String getStrings()
      String that corresponds with the valid values for this enum. <p> For example, "ALTA,MEDIA,BAJA", means: <ul> <li> ordinal 0 in Java Enum for 'ALTA' in DB <li> ordinal 1 in Java Enum for 'MEDIA' in DB <li> ordinal 2 in Java Enum for 'BAJA' in DB <li> </ul>
    • setStrings

      public void setStrings(String strings)
      String that corresponds with the valid values for this enum. <p> For example, "ALTA,MEDIA,BAJA", means: <ul> <li> ordinal 0 in Java Enum for 'ALTA' in DB <li> ordinal 1 in Java Enum for 'MEDIA' in DB <li> ordinal 2 in Java Enum for 'BAJA' in DB <li> </ul>