java.lang.Object | ||
↳ | org.hibernate.type.AbstractType | |
↳ | org.hibernate.type.CollectionType |
Known Direct Subclasses |
Known Indirect Subclasses |
A type that handles Hibernate PersistentCollections (including arrays).
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
UNFETCHED_COLLECTION |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Reconstruct the object from its cached "disassembled" state.
| |||||||||||
Perform a
Comparator style comparison between values | |||||||||||
Return a deep copy of the persistent state, stopping at entities and at
collections.
| |||||||||||
Return a cacheable "disassembled" representation of the object.
| |||||||||||
Parse the XML representation of an instance.
| |||||||||||
Get the entity name of the associated entity
| |||||||||||
Get the "persister" for this association - a class or
collection persister
| |||||||||||
instantiate a collection wrapper (called when loading an object)
| |||||||||||
How many columns are used to persist this type.
| |||||||||||
Get the Hibernate type of the collection elements
| |||||||||||
Get an iterator over the element set of the collection, which may not yet be wrapped
| |||||||||||
Get the foreign key directionality of this association
| |||||||||||
Get a hash code, consistent with persistence "equality".
| |||||||||||
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
| |||||||||||
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
| |||||||||||
Get the name of a property in the owning entity
that provides the join key (null if the identifier)
| |||||||||||
Returns the abbreviated name of the type.
| |||||||||||
Get the "filtering" SQL fragment that is applied in the
SQL on clause, in addition to the usual join condition
| |||||||||||
The name of a unique property of the associated entity
that provides the join key (null if the identifier of
an entity, or key of a collection)
| |||||||||||
Retrieve an instance of the mapped class, or the identifier of an entity or collection,
from a JDBC resultset.
| |||||||||||
Instantiate an uninitialized collection wrapper or holder.
| |||||||||||
Instantiate an empty instance of the "underlying" collection (not a wrapper),
but with the given anticipated size (i.e.
| |||||||||||
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
| |||||||||||
Note: return true because this type is castable to AssociationType.
| |||||||||||
Return true if the implementation is castable to
CollectionType . | |||||||||||
Should the parent be considered dirty, given both the old and current value?
| |||||||||||
Should the parent be considered dirty, given both the old and current value?
| |||||||||||
Compare two instances of the class mapped by this type for persistence "equality" (equality of persistent
state).
| |||||||||||
Has the value been modified compared to the current database state? The difference between this
and the
isDirty(Object, Object, boolean[], SessionImplementor) methods is that here we need to account for "partially" built values. | |||||||||||
Are objects of this type mutable.
| |||||||||||
Retrieve an instance of the mapped class from a JDBC resultset.
| |||||||||||
Retrieve an instance of the mapped class from a JDBC resultset.
| |||||||||||
Write an instance of the mapped class to a prepared statement.
| |||||||||||
Write an instance of the mapped class to a prepared statement, ignoring some columns.
| |||||||||||
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.
| |||||||||||
Replace the elements of a collection with the elements of another collection.
| |||||||||||
Map identifiers to entities or collections.
| |||||||||||
Given a hydrated, but unresolved value, return a value that may be used to
reconstruct property-ref associations.
| |||||||||||
A representation of the value to be embedded in an XML element.
| |||||||||||
Return the JDBC types codes (per java.sql.Types) for the columns mapped by this type.
| |||||||||||
Given an instance of the type, return an array of boolean, indicating
which mapped columns would be null.
| |||||||||||
A representation of the value to be embedded in a log file.
| |||||||||||
Is the primary key of the owning entity table
to be used in the join?
| |||||||||||
Wrap the naked collection instance in a wrapper, or instantiate a
holder.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Get an iterator over the element set of the collection in POJO mode
| |||||||||||
Instantiate a new "underlying" collection exhibiting the same capacity
charactersitcs and the passed "original".
| |||||||||||
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.hibernate.type.AbstractType
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
org.hibernate.type.AssociationType
| |||||||||||
From interface
org.hibernate.type.Type
|
Reconstruct the object from its cached "disassembled" state.
cached | the disassembled state from the cache |
---|---|
session | the session |
owner | the parent entity object |
HibernateException |
---|
Perform a Comparator
style comparison between values
x | The first value |
---|---|
y | The second value |
entityMode | The entity mode of the values. |
compare(T, T)
for a discussion.
Return a deep copy of the persistent state, stopping at entities and at collections.
value | generally a collection element or entity field |
---|
HibernateException |
---|
Return a cacheable "disassembled" representation of the object.
value | the value to cache |
---|---|
session | the session |
owner | optional parent entity object (needed for collections) |
HibernateException |
---|
Parse the XML representation of an instance.
HibernateException |
---|
Get the entity name of the associated entity
MappingException |
---|
Get the "persister" for this association - a class or collection persister
MappingException |
---|
instantiate a collection wrapper (called when loading an object)
key | The collection owner key |
---|---|
session | The session from which the request is originating. |
owner | The collection owner |
How many columns are used to persist this type. Always the same as sqlTypes(mapping).length
session | The mapping object :/ |
---|
MappingException |
---|
Get the Hibernate type of the collection elements
factory | The session factory. |
---|
MappingException | Indicates the underlying persister could not be located. |
---|
Get an iterator over the element set of the collection, which may not yet be wrapped
collection | The collection to be iterated |
---|---|
session | The session from which the request is originating. |
Get the foreign key directionality of this association
Get a hash code, consistent with persistence "equality". Again for most types the normal usage is to delegate to the value's #hashCode.
x | The value for which to retrieve a hash code |
---|---|
entityMode | The entity mode of the value. |
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 key |
---|---|
session | The session from which the request is originating. |
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 owner |
---|---|
session | The session from which the request is originating. |
Get the name of a property in the owning entity that provides the join key (null if the identifier)
Returns the abbreviated name of the type.
Get the "filtering" SQL fragment that is applied in the SQL on clause, in addition to the usual join condition
MappingException |
---|
The name of a unique property of the associated entity that provides the join key (null if the identifier of an entity, or key of a collection)
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().
name | the column names |
---|---|
session | the session |
owner | the parent entity |
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. |
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. |
---|
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
Note: return true because this type is castable to AssociationType. Not because all collections are associations.
AssociationType
implementor; false otherwise.
Return true if the implementation is castable to CollectionType
. Essentially a polymorphic version of
(type instanceof CollectionType.class)
CollectionType
is additionally an AssociationType
; so if this method returns true,
isAssociationType()
should also return true.CollectionType
implementor; false otherwise.
Should the parent be considered dirty, given both the old and current value?
old | the old value |
---|---|
current | the current value |
checkable | An array of booleans indicating which columns making up the value are actually checkable |
session | The session from which the request originated. |
HibernateException |
---|
Should the parent be considered dirty, given both the old and current value?
old | the old value |
---|---|
current | the current value |
session | The session from which the request originated. |
HibernateException |
---|
Compare two instances of the class mapped by this type for persistence "equality" (equality of persistent state).
This should always equate to some form of comparison of the value's internal state. As an example, for something like a date the comparison should be based on its internal "time" state based on the specific portion it is meant to represent (timestamp, date, time).x | The first value |
---|---|
y | The second value |
entityMode | The entity mode of the values. |
Has the value been modified compared to the current database state? The difference between this
and the isDirty(Object, Object, boolean[], SessionImplementor)
methods is that here we need to account for "partially" built values. This is really
only an issue with association types. For most type implementations it is enough to simply delegate to
isDirty(Object, Object, boolean[], SessionImplementor)
here/
old | the database state, in a "hydrated" form, with identifiers unresolved |
---|---|
current | the current state of the object |
checkable | which columns are actually updatable |
session | The session from which the request originated. |
HibernateException |
---|
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.)
Retrieve an instance of the mapped class from a JDBC resultset. Implementors should handle possibility of null values.
name | the column names |
---|---|
owner | the parent entity |
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.
name | the column name |
---|---|
owner | the parent entity |
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.
value | the object to write |
---|---|
index | statement parameter index |
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.
value | the object to write |
---|---|
index | statement parameter index |
settable | an array indicating which columns to ignore |
HibernateException | |
---|---|
SQLException |
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.
original | the value from the detached entity being merged |
---|---|
target | the value in the managed entity |
HibernateException |
---|
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 merged |
copyCache | The map of elements already replaced. |
session | The session from which the merge event originated. |
Map identifiers to entities or collections. This is the second phase of 2-phase property initialization.
value | an identifier or value returned by hydrate() |
---|---|
session | the session |
owner | the parent entity |
HibernateException |
---|
Given a hydrated, but unresolved value, return a value that may be used to reconstruct property-ref associations.
HibernateException |
---|
A representation of the value to be embedded in an XML element.
HibernateException |
---|
Return the JDBC types codes (per java.sql.Types) for the columns mapped by this type.
session | The mapping object :/ |
---|
MappingException |
---|
Given an instance of the type, return an array of boolean, indicating which mapped columns would be null.
value | an instance of the type |
---|
A representation of the value to be embedded in a log file.
HibernateException |
---|
Is the primary key of the owning entity table to be used in the join?
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. |
Get an iterator over the element set of the collection in POJO mode
collection | The collection to be iterated |
---|
Instantiate a new "underlying" collection exhibiting the same capacity charactersitcs and the passed "original".
original | The original collection. |
---|
HibernateException |
---|