org.hibernate.type

Class SerializableType

Implemented Interfaces:
Serializable, Type

public class SerializableType
extends MutableType

serializable: A type that maps an SQL VARBINARY to a serializable Java object.
Author:
Gavin King

Constructor Summary

SerializableType(Class serializableClass)

Method Summary

Object
assemble(Serializable cached, SessionImplementor session, Object owner)
Reconstruct the object from its cached "disassembled" state.
Object
deepCopyNotNull(Object value)
Serializable
disassemble(Object value, SessionImplementor session, Object owner)
Return a cacheable "disassembled" representation of the object.
Object
fromStringValue(String xml)
Object
get(ResultSet rs, String name)
int
getHashCode(Object x, EntityMode entityMode)
Get a hashcode, consistent with persistence "equality"
String
getName()
Returns the abbreviated name of the type.
Class
getReturnedClass()
The class returned by nullSafeGet() methods.
boolean
isEqual(Object x, Object y)
void
set(PreparedStatement st, Object value, int index)
int
sqlType()
String
toString(Object value)

Methods inherited from class org.hibernate.type.MutableType

deepCopy, deepCopyNotNull, isMutable, replace

Methods inherited from class org.hibernate.type.NullableType

fromStringValue, fromXMLNode, fromXMLString, get, getColumnSpan, isDirty, isEqual, isEqual, nullSafeGet, nullSafeGet, nullSafeGet, nullSafeGet, nullSafeSet, nullSafeSet, nullSafeSet, nullSafeToString, set, setToXMLNode, sqlType, sqlTypes, toColumnNullness, toLoggableString, toString, toXMLString

Methods inherited from class org.hibernate.type.AbstractType

assemble, beforeAssemble, compare, disassemble, getHashCode, getHashCode, getSemiResolvedType, hydrate, isAnyType, isAssociationType, isCollectionType, isComponentType, isDirty, isEntityType, isEqual, isEqual, isModified, isSame, isXMLElement, replace, replaceNode, resolve, semiResolve

Constructor Details

SerializableType

public SerializableType(Class serializableClass)

Method Details

assemble

public Object assemble(Serializable cached,
                       SessionImplementor session,
                       Object owner)
            throws HibernateException
Reconstruct the object from its cached "disassembled" state.
Specified by:
assemble in interface Type
Overrides:
assemble in interface AbstractType
Parameters:
cached - the disassembled state from the cache
session - the session
owner - the parent entity object
Returns:
the the object

deepCopyNotNull

public Object deepCopyNotNull(Object value)
            throws HibernateException
Overrides:
deepCopyNotNull in interface MutableType

disassemble

public Serializable disassemble(Object value,
                                SessionImplementor session,
                                Object owner)
            throws HibernateException
Return a cacheable "disassembled" representation of the object.
Specified by:
disassemble in interface Type
Overrides:
disassemble in interface AbstractType
Parameters:
value - the value to cache
session - the session
owner - optional parent entity object (needed for collections)
Returns:
the disassembled, deep cloned state

fromStringValue

public Object fromStringValue(String xml)
            throws HibernateException
Overrides:
fromStringValue in interface NullableType

get

public Object get(ResultSet rs,
                  String name)
            throws HibernateException,
                   SQLException
Overrides:
get in interface NullableType

getHashCode

public int getHashCode(Object x,
                       EntityMode entityMode)
Get a hashcode, consistent with persistence "equality"
Specified by:
getHashCode in interface Type
Overrides:
getHashCode in interface AbstractType
Parameters:
x -
entityMode -

getName

public String getName()
Returns the abbreviated name of the type.
Specified by:
getName in interface Type
Returns:
String the Hibernate type name

getReturnedClass

public Class getReturnedClass()
The class returned by nullSafeGet() methods. This is used to establish the class of an array of this type.
Specified by:
getReturnedClass in interface Type
Returns:
Class

isEqual

public boolean isEqual(Object x,
                       Object y)
            throws HibernateException
Overrides:
isEqual in interface NullableType

set

public void set(PreparedStatement st,
                Object value,
                int index)
            throws HibernateException,
                   SQLException
Overrides:
set in interface NullableType

sqlType

public int sqlType()
Overrides:
sqlType in interface NullableType

toString

public String toString(Object value)
            throws HibernateException
Overrides:
toString in interface NullableType