Superclass of single-column nullable types.
fromStringValue
public abstract Object fromStringValue(String xml)
throws HibernateException
get
public abstract Object get(ResultSet rs,
String name)
throws HibernateException,
SQLException
Get a column value from a result set, without worrying about the
possibility of null values. Called from nullSafeGet
after
nullness checks have been performed.
rs
- The result set from which to extract the value.name
- The name of the value to extract.
getColumnSpan
public final int getColumnSpan(Mapping session)
How many columns are used to persist this type.
- getColumnSpan in interface Type
isDirty
public boolean isDirty(Object old,
Object current,
boolean[] checkable,
SessionImplementor session)
throws HibernateException
Should the parent be considered dirty, given both the old and current field or
element value?
- isDirty in interface Type
old
- the old valuecurrent
- the current valuecheckable
- which columns are actually updatablesession
-
- true if the field is dirty
isEqual
public boolean isEqual(Object x,
Object y)
isEqual
public final boolean isEqual(Object x,
Object y,
EntityMode entityMode)
Compare two instances of the class mapped by this type for persistence
"equality" - equality of persistent state.
- isEqual in interface Type
- isEqual in interface AbstractType
nullSafeGet
public final Object nullSafeGet(ResultSet rs,
String name)
throws HibernateException,
SQLException
nullSafeGet
public final Object nullSafeGet(ResultSet rs,
String name,
SessionImplementor session,
Object owner)
throws HibernateException,
SQLException
Retrieve an instance of the mapped class from a JDBC resultset. Implementations
should handle possibility of null values. This method might be called if the
type is known to be a single-column type.
- nullSafeGet in interface Type
rs
- name
- the column namesession
- owner
- the parent entity
nullSafeGet
public final Object nullSafeGet(ResultSet rs,
String[] names)
throws HibernateException,
SQLException
nullSafeGet
public final Object nullSafeGet(ResultSet rs,
String[] names,
SessionImplementor session,
Object owner)
throws HibernateException,
SQLException
Retrieve an instance of the mapped class from a JDBC resultset. Implementors
should handle possibility of null values.
- nullSafeGet in interface Type
rs
- names
- the column namessession
- owner
- the parent entity
nullSafeSet
public final void nullSafeSet(PreparedStatement st,
Object value,
int index)
throws HibernateException,
SQLException
nullSafeSet
public final void nullSafeSet(PreparedStatement st,
Object value,
int index,
boolean[] settable,
SessionImplementor session)
throws HibernateException,
SQLException
Write an instance of the mapped class to a prepared statement, ignoring some columns.
Implementors should handle possibility of null values. A multi-column type should be
written to parameters starting from index.
- nullSafeSet in interface Type
st
- value
- the object to writeindex
- statement parameter indexsettable
- an array indicating which columns to ignoresession
-
nullSafeSet
public final void nullSafeSet(PreparedStatement st,
Object value,
int index,
SessionImplementor session)
throws HibernateException,
SQLException
Write an instance of the mapped class to a prepared statement. Implementors
should handle possibility of null values. A multi-column type should be written
to parameters starting from index.
- nullSafeSet in interface Type
st
- value
- the object to writeindex
- statement parameter indexsession
-
nullSafeToString
public String nullSafeToString(Object value)
throws HibernateException
A null-safe version of
toString(Object)
. Specifically we are
worried about null safeness in regards to the incoming value parameter,
not the return.
value
- The value to convert to a string representation; may be null.
- The string representation; may be null.
set
public abstract void set(PreparedStatement st,
Object value,
int index)
throws HibernateException,
SQLException
Set a parameter value without worrying about the possibility of null
values. Called from nullSafeSet
after nullness checks have
been performed.
st
- The statement into which to bind the parameter value.value
- The parameter value to bind.index
- The position or index at which to bind the param value.
sqlType
public abstract int sqlType()
A convenience form of
sqlTypes(Mapping)
, returning
just a single type value since these are explicitly dealing with single column
mappings.
- The
java.sql.Types
mapping value.
sqlTypes
public final int[] sqlTypes(Mapping session)
Return the SQL type codes for the columns mapped by this type. The codes
are defined on java.sql.Types.
- sqlTypes in interface Type
toColumnNullness
public boolean[] toColumnNullness(Object value,
Mapping mapping)
Given an instance of the type, return an array of boolean, indicating
which mapped columns would be null.
- toColumnNullness in interface Type
value
- an instance of the type