assemble
public Object assemble(Serializable cached,
SessionImplementor session,
Object owner)
throws HibernateException
Reconstruct the object from its cached "disassembled" state.
- assemble in interface Type
- assemble in interface AbstractType
cached
- the disassembled state from the cachesession
- the sessionowner
- the parent entity object
disassemble
public Serializable disassemble(Object value,
SessionImplementor session,
Object owner)
throws HibernateException
Return a cacheable "disassembled" representation of the object.
- disassemble in interface Type
- disassemble in interface AbstractType
value
- the value to cachesession
- the sessionowner
- optional parent entity object (needed for collections)
- the disassembled, deep cloned state
fromXMLString
public Object fromXMLString(String xml,
Mapping factory)
getColumnSpan
public int getColumnSpan(Mapping session)
How many columns are used to persist this type.
- getColumnSpan in interface Type
getComparator
public Comparator getComparator()
Get a comparator for version values.
- getComparator in interface VersionType
- The comparator to use to compare different version values.
getName
public String getName()
Returns the abbreviated name of the type.
- getName in interface Type
- String the Hibernate type name
getReturnedClass
public Class getReturnedClass()
The class returned by nullSafeGet() methods. This is used to
establish the class of an array of this type.
- getReturnedClass 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)
throws HibernateException
Are the two version values considered equal?
- isEqual in interface VersionType
x
- One value to check.y
- The other value to check.
- true if the values are equal, false otherwise.
isMutable
public boolean isMutable()
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.)
- isMutable in interface Type
next
public Object next(Object current,
SessionImplementor session)
Increment the version.
- next in interface VersionType
current
- the current versionsession
- The session from which this request originates.
nullSafeGet
public Object nullSafeGet(ResultSet rs,
String columnName,
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
- session
- owner
- the parent entity
nullSafeGet
public 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 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 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
-
objectToSQLString
public String objectToSQLString(Object value,
Dialect dialect)
throws Exception
String representation of the value, suitable for embedding in
an SQL statement.
- objectToSQLString in interface LiteralType
- String the value, as it appears in a SQL query
replace
public Object replace(Object original,
Object target,
SessionImplementor session,
Object owner,
Map copyCache)
throws HibernateException
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.
- replace in interface Type
original
- the value from the detached entity being mergedtarget
- the value in the managed entity
seed
public Object seed(SessionImplementor session)
Generate an initial version.
- seed in interface VersionType
session
- The session from which this request originates.
sqlTypes
public int[] sqlTypes(Mapping pi)
Return the SQL type codes for the columns mapped by this type. The codes
are defined on java.sql.Types.
- sqlTypes in interface Type
stringToObject
public Object stringToObject(String xml)
Convert the value from the mapping file to a Java object.
- stringToObject in interface IdentifierType
xml
- the value of discriminator-value or unsaved-value attribute
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