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

See Also:
Serialized Form

Field Summary
static String CLASS_NAME
          class name of the serialisable class
 
Fields inherited from class org.hibernate.type.AbstractType
LEGACY_DEFAULT_SIZE, LEGACY_DICTATED_SIZE
 
Constructor Summary
SerializableToBlobType()
           
 
Method Summary
 Object deepCopy(Object value, 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, SessionFactoryImplementor session)
          Get a hash code, consistent with persistence "equality".
 Class getReturnedClass()
          The class returned by Type.nullSafeGet(java.sql.ResultSet, java.lang.String[], org.hibernate.engine.spi.SessionImplementor, java.lang.Object) methods.
 boolean isEqual(Object x, Object y, 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 JDBC types codes (per Types) 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)
          Generate a representation of the value for logging purposes.
 
Methods inherited from class org.hibernate.type.AbstractLobType
defaultSizes, dictatedSizes, 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 JDBC types codes (per Types) for the columns mapped by this type.

NOTE: The number of elements in this array matches the return from Type.getColumnSpan(org.hibernate.engine.spi.Mapping).

Specified by:
sqlTypes in interface Type
Parameters:
mapping - The mapping object :/
Returns:
The JDBC type codes.
Throws:
MappingException - Generally indicates an issue accessing the passed mapping object.

getReturnedClass

public Class getReturnedClass()
Description copied from interface: Type
The class returned by Type.nullSafeGet(java.sql.ResultSet, java.lang.String[], org.hibernate.engine.spi.SessionImplementor, java.lang.Object) methods. This is used to establish the class of an array of this type.

Specified by:
getReturnedClass in interface Type
Returns:
The java type class handled by this type.

isEqual

public boolean isEqual(Object x,
                       Object y,
                       SessionFactoryImplementor factory)
Description copied from interface: Type
Compare two instances of the class mapped by this type for persistence "equality" (equality of persistent state).

This should always equate to some form of comparison of the value's internal state. As an example, for something like a date the comparison should be based on its internal "time" state based on the specific portion it is meant to represent (timestamp, date, time).

Specified by:
isEqual in interface Type
Overrides:
isEqual in class AbstractType
Parameters:
x - The first value
y - The second value
factory - The session factory
Returns:
True if there are considered equal (see discussion above).

getHashCode

public int getHashCode(Object x,
                       SessionFactoryImplementor session)
Description copied from interface: Type
Get a hash code, consistent with persistence "equality". Again for most types the normal usage is to delegate to the value's hashCode.

Specified by:
getHashCode in interface Type
Overrides:
getHashCode in class AbstractType
Parameters:
x - The value for which to retrieve a hash code
session - The session factory
Returns:
The hash code

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
Parameters:
node - The XML node to which to write the value
value - The value to write
factory - The session factory
Throws:
HibernateException - An error from Hibernate

toLoggableString

public String toLoggableString(Object value,
                               SessionFactoryImplementor factory)
                        throws HibernateException
Description copied from interface: Type
Generate a representation of the value for logging purposes.

Specified by:
toLoggableString in interface Type
Parameters:
value - The value to be logged
factory - The session factory
Returns:
The loggable representation
Throws:
HibernateException - An error from Hibernate

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
Parameters:
xml - The XML node from which to read the value
factory - The session factory
Returns:
an instance of the mapped class
Throws:
HibernateException - An error from Hibernate

deepCopy

public Object deepCopy(Object value,
                       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 - The value to be copied
factory - The session factory
Returns:
The deep copy
Throws:
HibernateException - An error from Hibernate

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
session - The originating session
owner - The owner of the value
copyCache - The cache of already copied/replaced values
Returns:
the value to be merged
Throws:
HibernateException - An error from Hibernate

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
mapping - The mapping abstraction
Returns:
array indicating column nullness for a value instance

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-2012 Red Hat, Inc. All Rights Reserved.