org.hibernate.type
Class BinaryType

java.lang.Object
  extended byorg.hibernate.type.AbstractType
      extended byorg.hibernate.type.NullableType
          extended byorg.hibernate.type.MutableType
              extended byorg.hibernate.type.BinaryType
All Implemented Interfaces:
Comparator, Serializable, Type, VersionType

public class BinaryType
extends MutableType
implements VersionType, Comparator

binary: A type that maps an SQL VARBINARY to a Java byte[].

Author:
Gavin King
See Also:
Serialized Form

Constructor Summary
BinaryType()
           
 
Method Summary
 int compare(Object o1, Object o2)
           
 int compare(Object x, Object y, EntityMode entityMode)
          compare two instances of the type
 Object deepCopyNotNull(Object value)
           
 Object fromStringValue(String xml)
           
 Object get(ResultSet rs, String name)
          Get a column value from a result set, without worrying about the possibility of null values
 Comparator getComparator()
          Get a comparator for version values.
 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)
          Are the two version values considered equal?
 Object next(Object current, SessionImplementor session)
          Increment the version.
 Object seed(SessionImplementor session)
          Generate an initial version.
 void set(PreparedStatement st, Object value, int index)
          Get a parameter value without worrying about the possibility of null values
 int sqlType()
           
 String toString(Object val)
           
 
Methods inherited from class org.hibernate.type.MutableType
deepCopy, isMutable, replace
 
Methods inherited from class org.hibernate.type.NullableType
fromXMLNode, fromXMLString, getColumnSpan, isDirty, isEqual, nullSafeGet, nullSafeGet, nullSafeGet, nullSafeGet, nullSafeSet, nullSafeSet, nullSafeSet, setToXMLNode, sqlTypes, toColumnNullness, toLoggableString, toXMLString
 
Methods inherited from class org.hibernate.type.AbstractType
assemble, beforeAssemble, disassemble, getHashCode, getSemiResolvedType, hydrate, isAnyType, isAssociationType, isCollectionType, isComponentType, isDirty, isEntityType, isEqual, 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
 
Methods inherited from interface org.hibernate.type.Type
assemble, beforeAssemble, deepCopy, disassemble, fromXMLNode, getColumnSpan, getHashCode, getSemiResolvedType, hydrate, isAnyType, isAssociationType, isCollectionType, isComponentType, isDirty, isDirty, isEntityType, isEqual, isEqual, isModified, isMutable, isSame, isXMLElement, nullSafeGet, nullSafeGet, nullSafeSet, nullSafeSet, replace, replace, resolve, semiResolve, setToXMLNode, sqlTypes, toColumnNullness, toLoggableString
 
Methods inherited from interface java.util.Comparator
equals
 

Constructor Detail

BinaryType

public BinaryType()
Method Detail

set

public void set(PreparedStatement st,
                Object value,
                int index)
         throws HibernateException,
                SQLException
Description copied from class: NullableType
Get a parameter value without worrying about the possibility of null values

Specified by:
set in class NullableType
Throws:
HibernateException
SQLException

get

public Object get(ResultSet rs,
                  String name)
           throws HibernateException,
                  SQLException
Description copied from class: NullableType
Get a column value from a result set, without worrying about the possibility of null values

Specified by:
get in class NullableType
Throws:
HibernateException
SQLException

sqlType

public int sqlType()
Specified by:
sqlType in class NullableType

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

seed

public Object seed(SessionImplementor session)
Description copied from interface: VersionType
Generate an initial version.

Specified by:
seed in interface VersionType
Parameters:
session - The session from which this request originates.
Returns:
an instance of the type

next

public Object next(Object current,
                   SessionImplementor session)
Description copied from interface: VersionType
Increment the version.

Specified by:
next in interface VersionType
Parameters:
session - The session from which this request originates.
current - the current version
Returns:
an instance of the type

getComparator

public Comparator getComparator()
Description copied from interface: VersionType
Get a comparator for version values.

Specified by:
getComparator in interface VersionType
Returns:
The comparator to use to compare different version values.

compare

public int compare(Object o1,
                   Object o2)
Specified by:
compare in interface Comparator

isEqual

public boolean isEqual(Object x,
                       Object y)
Description copied from interface: VersionType
Are the two version values considered equal?

Specified by:
isEqual in interface VersionType
Overrides:
isEqual in class NullableType

getHashCode

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

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

compare

public int compare(Object x,
                   Object y,
                   EntityMode entityMode)
Description copied from interface: Type
compare two instances of the type

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

getName

public String getName()
Description copied from interface: Type
Returns the abbreviated name of the type.

Specified by:
getName in interface Type
Returns:
String the Hibernate type name

toString

public String toString(Object val)
Specified by:
toString in class NullableType

deepCopyNotNull

public Object deepCopyNotNull(Object value)
Specified by:
deepCopyNotNull in class MutableType

fromStringValue

public Object fromStringValue(String xml)
                       throws HibernateException
Specified by:
fromStringValue in class NullableType
Throws:
HibernateException