ome.tools.hibernate
Class ListAsSQLArrayUserType<T>

java.lang.Object
  extended by ome.tools.hibernate.ListAsSQLArrayUserType<T>
All Implemented Interfaces:
org.hibernate.usertype.ParameterizedType, org.hibernate.usertype.UserType
Direct Known Subclasses:
ListAsSQLArrayUserType.BOOLEAN, ListAsSQLArrayUserType.DATE, ListAsSQLArrayUserType.DOUBLE, ListAsSQLArrayUserType.ENUM, ListAsSQLArrayUserType.FLOAT, ListAsSQLArrayUserType.INTEGER, ListAsSQLArrayUserType.STRING, ListAsSQLArrayUserType.STRING2

public abstract class ListAsSQLArrayUserType<T>
extends Object
implements org.hibernate.usertype.UserType, org.hibernate.usertype.ParameterizedType

Hibernate type to store Lists of primitives using SQL ARRAY.

Author:
Sylvain References : http://forum.hibernate.org/viewtopic.php?t=946973 http://archives.postgresql.org/pgsql-jdbc/2003-02/msg00141.php

Nested Class Summary
static interface ListAsSQLArrayUserType.ArrayFactory
           
static class ListAsSQLArrayUserType.BOOLEAN
          To use, define : hibernate.property type="ome.tools.hibernate.ListAsSQLArrayUserType$BOOLEAN" hibernate.column name="fieldName" sql-type="bool[]"
static class ListAsSQLArrayUserType.DATE
          To use, define : hibernate.property type="ome.tools.hibernate.ListAsSQLArrayUserType$DATE" hibernate.column name="fieldName" sql-type="timestamp[]"
static class ListAsSQLArrayUserType.DOUBLE
          To use, define : hibernate.property type="ome.tools.hibernate.ListAsSQLArrayUserType$DOUBLE" hibernate.column name="fieldName" sql-type="float8[]"
static class ListAsSQLArrayUserType.ENUM<E extends Enum<E>>
          Warning, this one is special.
static class ListAsSQLArrayUserType.FLOAT
          To use, define : hibernate.property type="ome.tools.hibernate.ListAsSQLArrayUserType$FLOAT" hibernate.column name="fieldName" sql-type="real[]"
static class ListAsSQLArrayUserType.INTEGER
          To use, define : hibernate.property type="ome.tools.hibernate.ListAsSQLArrayUserType$INTEGER" hibernate.column name="fieldName" sql-type="int[]"
static class ListAsSQLArrayUserType.STRING
          To use, define : hibernate.property type="ome.tools.hibernate.ListAsSQLArrayUserType$STRING" hibernate.column name="fieldName" sql-type="text[]"
static class ListAsSQLArrayUserType.STRING2
          To use, define : hibernate.property type="ome.tools.hibernate.ListAsSQLArrayUserType$STRING2" hibernate.column name="fieldName" sql-type="text[]" Added by Josh
 
Field Summary
protected  ListAsSQLArrayUserType.ArrayFactory factory
           
 
Constructor Summary
ListAsSQLArrayUserType()
           
 
Method Summary
 Object assemble(Serializable cached, Object owner)
           
 Object deepCopy(Object value)
           
 Serializable disassemble(Object value)
           
 boolean equals(Object x, Object y)
           
protected abstract  Array getDataAsArray(Connection conn, Object value)
           
protected abstract  List<T> getDataFromArray(Object primitivesArray)
           
 int hashCode(Object x)
           
 boolean isMutable()
           
 Object nullSafeGet(ResultSet resultSet, String[] names, Object owner)
           
 void nullSafeSet(PreparedStatement preparedStatement, Object value, int index)
           
 Object replace(Object original, Object target, Object owner)
           
 Class returnedClass()
           
 void setParameterValues(Properties parameters)
           
 int[] sqlTypes()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

factory

protected ListAsSQLArrayUserType.ArrayFactory factory
Constructor Detail

ListAsSQLArrayUserType

public ListAsSQLArrayUserType()
Method Detail

setParameterValues

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

getDataAsArray

protected abstract Array getDataAsArray(Connection conn,
                                        Object value)
                                 throws SQLException
Throws:
SQLException

getDataFromArray

protected abstract List<T> getDataFromArray(Object primitivesArray)

returnedClass

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

sqlTypes

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

deepCopy

public Object deepCopy(Object value)
Specified by:
deepCopy in interface org.hibernate.usertype.UserType

isMutable

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

nullSafeGet

public Object nullSafeGet(ResultSet resultSet,
                          String[] names,
                          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 preparedStatement,
                        Object value,
                        int index)
                 throws org.hibernate.HibernateException,
                        SQLException
Specified by:
nullSafeSet in interface org.hibernate.usertype.UserType
Throws:
org.hibernate.HibernateException
SQLException

hashCode

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

equals

public boolean equals(Object x,
                      Object y)
               throws org.hibernate.HibernateException
Specified by:
equals 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

disassemble

public Serializable disassemble(Object value)
                         throws org.hibernate.HibernateException
Specified by:
disassemble 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


OmeroJava Api

Version: 4.3.3-00d1137e-b2894

Copyright © 2009 The University of Dundee. All Rights Reserved.