deepCopy
public Object deepCopy(Object value,
EntityMode entityMode,
SessionFactoryImplementor factory)
Return a deep copy of the persistent state, stopping at entities and at
collections.
- deepCopy in interface Type
value
- generally a collection element or entity fieldentityMode
- factory
-
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
fromXMLNode
public Object fromXMLNode(Node xml,
Mapping factory)
Parse the XML representation of an instance.
- fromXMLNode in interface Type
getColumnSpan
public int getColumnSpan(Mapping mapping)
How many columns are used to persist this type.
- getColumnSpan in interface Type
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,
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
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
nullSafeGet
public 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 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
-
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
sqlTypes
public int[] sqlTypes(Mapping mapping)
throws MappingException
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