org.hibernate.type
Class SerializableToBlobType

java.lang.Object
  extended by org.hibernate.type.AbstractType
      extended by org.hibernate.type.AbstractLobType
          extended by org.hibernate.type.SerializableToBlobType
All Implemented Interfaces:
Serializable, Type, ParameterizedType

public class SerializableToBlobType
extends AbstractLobType
implements ParameterizedType

Author:
Emmanuel Bernard
See Also:
Serialized Form

Field Summary
static String CLASS_NAME
          class name of the serialisable class
 
Constructor Summary
SerializableToBlobType()
           
 
Method Summary
 Object deepCopy(Object value, EntityMode entityMode, SessionFactoryImplementor factory)
          Return a deep copy of the persistent state, stopping at entities and at collections.
 Object fromXMLNode(org.dom4j.Node xml, Mapping factory)
          Parse the XML representation of an instance.
 Object get(ResultSet rs, String name)
           
 int getHashCode(Object x, EntityMode entityMode, SessionFactoryImplementor session)
          Get a hashcode, consistent with persistence "equality"
 Class getReturnedClass()
          The class returned by nullSafeGet() methods.
 boolean isEqual(Object x, Object y, EntityMode entityMode, SessionFactoryImplementor factory)
          Compare two instances of the class mapped by this type for persistence "equality" - equality of persistent state.
 boolean isMutable()
          Are objects of this type mutable.
 Object replace(Object original, Object target, SessionImplementor session, Object owner, Map copyCache)
          During merge, replace the existing (target) value in the entity we are merging to with a new (original) value from the detached entity we are merging.
 void set(PreparedStatement st, Object value, int index, SessionImplementor session)
           
 void setParameterValues(Properties parameters)
          Gets called by Hibernate to pass the configured type parameters to the implementation.
 void setToXMLNode(org.dom4j.Node node, Object value, SessionFactoryImplementor factory)
          A representation of the value to be embedded in an XML element.
 int[] sqlTypes(Mapping mapping)
          Return the SQL type codes for the columns mapped by this type.
 boolean[] toColumnNullness(Object value, Mapping mapping)
          Given an instance of the type, return an array of boolean, indicating which mapped columns would be null.
 String toLoggableString(Object value, SessionFactoryImplementor factory)
          A representation of the value to be embedded in a log file.
 
Methods inherited from class org.hibernate.type.AbstractLobType
getColumnSpan, getHashCode, getName, isDirty, isEqual, nullSafeGet, nullSafeGet, nullSafeSet, nullSafeSet
 
Methods inherited from class org.hibernate.type.AbstractType
assemble, beforeAssemble, compare, disassemble, getSemiResolvedType, hydrate, isAnyType, isAssociationType, isCollectionType, isComponentType, isDirty, isEntityType, isModified, isSame, isXMLElement, replace, replaceNode, resolve, semiResolve
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_NAME

public static final String CLASS_NAME
class name of the serialisable class

See Also:
Constant Field Values
Constructor Detail

SerializableToBlobType

public SerializableToBlobType()
Method Detail

sqlTypes

public int[] sqlTypes(Mapping mapping)
               throws MappingException
Description copied from interface: Type
Return the SQL type codes for the columns mapped by this type. The codes are defined on java.sql.Types.

Specified by:
sqlTypes in interface Type
Returns:
the typecodes
Throws:
MappingException
See Also:
Types

getReturnedClass

public Class getReturnedClass()
Description copied from interface: Type
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,
                       EntityMode entityMode,
                       SessionFactoryImplementor factory)
Description copied from interface: Type
Compare two instances of the class mapped by this type for persistence "equality" - equality of persistent state.

Specified by:
isEqual in interface Type
Overrides:
isEqual in class AbstractType
Returns:
boolean

getHashCode

public int getHashCode(Object x,
                       EntityMode entityMode,
                       SessionFactoryImplementor session)
Description copied from interface: Type
Get a hashcode, consistent with persistence "equality"

Specified by:
getHashCode in interface Type
Overrides:
getHashCode in class AbstractType

get

public Object get(ResultSet rs,
                  String name)
           throws SQLException
Specified by:
get in class AbstractLobType
Throws:
SQLException

set

public void set(PreparedStatement st,
                Object value,
                int index,
                SessionImplementor session)
         throws SQLException
Specified by:
set in class AbstractLobType
Throws:
SQLException

setToXMLNode

public void setToXMLNode(org.dom4j.Node node,
                         Object value,
                         SessionFactoryImplementor factory)
                  throws HibernateException
Description copied from interface: Type
A representation of the value to be embedded in an XML element.

Specified by:
setToXMLNode in interface Type
Throws:
HibernateException

toLoggableString

public String toLoggableString(Object value,
                               SessionFactoryImplementor factory)
                        throws HibernateException
Description copied from interface: Type
A representation of the value to be embedded in a log file.

Specified by:
toLoggableString in interface Type
Returns:
String
Throws:
HibernateException

fromXMLNode

public Object fromXMLNode(org.dom4j.Node xml,
                          Mapping factory)
                   throws HibernateException
Description copied from interface: Type
Parse the XML representation of an instance.

Specified by:
fromXMLNode in interface Type
Returns:
an instance of the type
Throws:
HibernateException

deepCopy

public Object deepCopy(Object value,
                       EntityMode entityMode,
                       SessionFactoryImplementor factory)
                throws HibernateException
Description copied from interface: Type
Return a deep copy of the persistent state, stopping at entities and at collections.

Specified by:
deepCopy in interface Type
Parameters:
value - generally a collection element or entity field
Returns:
Object a copy
Throws:
HibernateException

isMutable

public boolean isMutable()
Description copied from interface: Type
Are objects of this type mutable. (With respect to the referencing object ... entities and collections are considered immutable because they manage their own internal state.)

Specified by:
isMutable in interface Type
Returns:
boolean

replace

public Object replace(Object original,
                      Object target,
                      SessionImplementor session,
                      Object owner,
                      Map copyCache)
               throws HibernateException
Description copied from interface: Type
During merge, replace the existing (target) value in the entity we are merging to with a new (original) value from the detached entity we are merging. For immutable objects, or null values, it is safe to simply return the first parameter. For mutable objects, it is safe to return a copy of the first parameter. For objects with component values, it might make sense to recursively replace component values.

Specified by:
replace in interface Type
Parameters:
original - the value from the detached entity being merged
target - the value in the managed entity
Returns:
the value to be merged
Throws:
HibernateException

toColumnNullness

public boolean[] toColumnNullness(Object value,
                                  Mapping mapping)
Description copied from interface: Type
Given an instance of the type, return an array of boolean, indicating which mapped columns would be null.

Specified by:
toColumnNullness in interface Type
Parameters:
value - an instance of the type

setParameterValues

public void setParameterValues(Properties parameters)
Description copied from interface: ParameterizedType
Gets called by Hibernate to pass the configured type parameters to the implementation.

Specified by:
setParameterValues in interface ParameterizedType


Copyright © 2001-2010 Red Hat, Inc. All Rights Reserved.