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
contains
public boolean contains(Object collection,
Object childObject,
SessionImplementor session)
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
getCollection
public Object getCollection(Serializable key,
SessionImplementor session,
Object owner)
instantiate a collection wrapper (called when loading an object)
key
- The collection owner keysession
- The session from which the request is originating.owner
- The collection owner
getElementsIterator
protected Iterator getElementsIterator(Object collection)
Get an iterator over the element set of the collection in POJO mode
collection
- The collection to be iterated
getElementsIterator
public Iterator getElementsIterator(Object collection,
SessionImplementor session)
Get an iterator over the element set of the collection, which may not yet be wrapped
collection
- The collection to be iteratedsession
- The session from which the request is originating.
getIdOfOwnerOrNull
public Serializable getIdOfOwnerOrNull(Serializable key,
SessionImplementor session)
Get the id value from the owning entity key, usually the same as the key, but might be some
other property, in the case of property-ref
key
- The collection owner keysession
- The session from which the request is originating.
- The collection owner's id, if it can be obtained from the key;
otherwise, null is returned
getKeyOfOwner
public Serializable getKeyOfOwner(Object owner,
SessionImplementor session)
Get the key value from the owning entity instance, usually the identifier, but might be some
other unique key, in the case of property-ref
owner
- The collection ownersession
- The session from which the request is originating.
- The collection owner's key
getName
public String getName()
Returns the abbreviated name of the type.
- getName in interface Type
- String the Hibernate type name
getRole
public String getRole()
hasHolder
public boolean hasHolder(EntityMode entityMode)
hydrate
public Object hydrate(ResultSet rs,
String[] name,
SessionImplementor session,
Object owner)
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
- session
- the sessionowner
- the parent entity
- Object an identifier or actual value
indexOf
public Object indexOf(Object collection,
Object element)
initializeImmediately
protected boolean initializeImmediately(EntityMode entityMode)
instantiate
public abstract Object instantiate(int anticipatedSize)
Instantiate an empty instance of the "underlying" collection (not a wrapper),
but with the given anticipated size (i.e. accounting for initial capacity
and perhaps load factor).
anticipatedSize
- The anticipated size of the instaniated collection
after we are done populating it.
- A newly instantiated collection to be wrapped.
instantiate
public abstract PersistentCollection instantiate(SessionImplementor session,
CollectionPersister persister,
Serializable key)
Instantiate an uninitialized collection wrapper or holder. Callers MUST add the holder to the
persistence context!
session
- The session from which the request is originating.persister
- The underlying collection persister (metadata)key
- The owner key.
- The instantiated collection.
instantiateResult
protected Object instantiateResult(Object original)
Instantiate a new "underlying" collection exhibiting the same capacity
charactersitcs and the passed "original".
original
- The original collection.
- The newly instantiated collection.
isAlwaysDirtyChecked
public boolean isAlwaysDirtyChecked()
We always need to dirty check the collection because we sometimes
need to incremement version number of owner and also because of
how assemble/disassemble is implemented for uks
- isAlwaysDirtyChecked in interface AssociationType
isArrayType
public boolean isArrayType()
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
isDirty
public boolean isDirty(Object old,
Object current,
SessionImplementor session)
throws HibernateException
Should the parent be considered dirty, given both the old and current field or
element value?
- isDirty in interface Type
- isDirty in interface AbstractType
old
- the old valuecurrent
- the current valuesession
-
- true if the field is dirty
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
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
nullSafeGet
public Object nullSafeGet(ResultSet rs,
String name,
SessionImplementor session,
Object owner)
throws 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[] name,
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
- session
- owner
- the parent entity
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 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
-
replaceElements
public Object replaceElements(Object original,
Object target,
Object owner,
Map copyCache,
SessionImplementor session)
Replace the elements of a collection with the elements of another collection.
original
- The 'source' of the replacement elements (where we copy from)target
- The target of the replacement elements (where we copy to)owner
- The owner of the collection being mergedcopyCache
- The map of elements already replaced.session
- The session from which the merge event originated.
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 session)
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
toString
public String toString()
wrap
public abstract PersistentCollection wrap(SessionImplementor session,
Object collection)
Wrap the naked collection instance in a wrapper, or instantiate a
holder. Callers MUST add the holder to the persistence context!
session
- The session from which the request is originating.collection
- The bare collection to be wrapped.