org.hibernate.type

Class ShortType

Implemented Interfaces:
DiscriminatorType, IdentifierType, Serializable, LiteralType, Serializable, Type, VersionType

public class ShortType
extends PrimitiveType
implements DiscriminatorType, VersionType

short: A type that maps an SQL SMALLINT to a Java Short.
Author:
Gavin King

Method Summary

Object
fromStringValue(String xml)
Object
get(ResultSet rs, String name)
Comparator
getComparator()
Get a comparator for version values.
Serializable
getDefaultValue()
String
getName()
Returns the abbreviated name of the type.
Class
getPrimitiveClass()
Class
getReturnedClass()
The class returned by nullSafeGet() methods.
Object
next(Object current, SessionImplementor session)
Increment the version.
String
objectToSQLString(Object value, Dialect dialect)
String representation of the value, suitable for embedding in an SQL statement.
Object
seed(SessionImplementor session)
Generate an initial version.
void
set(PreparedStatement st, Object value, int index)
int
sqlType()
Object
stringToObject(String xml)

Methods inherited from class org.hibernate.type.PrimitiveType

getDefaultValue, getPrimitiveClass, toString

Methods inherited from class org.hibernate.type.ImmutableType

deepCopy, 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

Method Details

fromStringValue

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

get

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

getComparator

public Comparator getComparator()
Get a comparator for version values.
Specified by:
getComparator in interface VersionType
Returns:
The comparator to use to compare different version values.

getDefaultValue

public Serializable getDefaultValue()
Overrides:
getDefaultValue in interface PrimitiveType

getName

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

getPrimitiveClass

public Class getPrimitiveClass()
Overrides:
getPrimitiveClass in interface PrimitiveType

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

next

public Object next(Object current,
                   SessionImplementor session)
Increment the version.
Specified by:
next in interface VersionType
Parameters:
current - the current version
session - The session from which this request originates.
Returns:
an instance of the type

objectToSQLString

public String objectToSQLString(Object value,
                                Dialect dialect)
            throws Exception
String representation of the value, suitable for embedding in an SQL statement.
Specified by:
objectToSQLString in interface LiteralType
Parameters:
value -
dialect -
Returns:
String the value, as it appears in a SQL query

seed

public Object seed(SessionImplementor session)
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

set

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

sqlType

public int sqlType()
Overrides:
sqlType in interface NullableType

stringToObject

public Object stringToObject(String xml)
            throws Exception
Specified by:
stringToObject in interface IdentifierType