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
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
hydrate
public Object hydrate(ResultSet rs,
String[] names,
SessionImplementor session,
Object owner)
throws HibernateException,
SQLException
Retrieve an instance of the mapped class, or the identifier of an entity or collection,
from a JDBC resultset. This is useful for 2-phase property initialization - the second
phase is a call to resolveIdentifier().
- hydrate in interface Type
- hydrate in interface AbstractType
rs
- names
- the column namessession
- the sessionowner
- the parent entity
- Object an identifier or actual value
isAnyType
public boolean isAnyType()
Is this an "any" type.
i.e. a reference to a persistent entity
that is not modelled as a (foreign key) association.
- isAnyType in interface Type
- isAnyType in interface AbstractType
isAssociationType
public boolean isAssociationType()
Return true if the implementation is castable to
AssociationType. This does not necessarily imply that
the type actually represents an association.
- isAssociationType in interface Type
- isAssociationType in interface AbstractType
isComponentType
public boolean isComponentType()
Is this type a component type. If so, the implementation
must be castable to AbstractComponentType. A component
type may own collections or associations and hence must provide
certain extra functionality.
- isComponentType in interface Type
- isComponentType in interface AbstractType
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
isModified
public boolean isModified(Object old,
Object current,
boolean[] checkable,
SessionImplementor session)
throws HibernateException
Has the parent object been modified, compared to the current database state?
- isModified in interface Type
- isModified in interface AbstractType
checkable
- which columns are actually updatablesession
-
- true if the field has been modified
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
isReferenceToPrimaryKey
public boolean isReferenceToPrimaryKey()
isSame
public boolean isSame(Object x,
Object y,
EntityMode entityMode)
throws HibernateException
Compare two instances of the class mapped by this type for persistence
"equality" - equality of persistent state - taking a shortcut for
entity references.
- isSame in interface Type
- isSame in interface AbstractType
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
resolve
public Object resolve(Object value,
SessionImplementor session,
Object owner)
throws HibernateException
Map identifiers to entities or collections. This is the second phase of 2-phase property
initialization.
- resolve in interface Type
- resolve in interface AbstractType
value
- an identifier or value returned by hydrate()session
- the sessionowner
- the parent entity
- the given value, or the value associated with the identifier
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