public interface CollectionPersister extends CollectionDefinition
A strategy for persisting a collection role. Defines a contract between
the persistence strategy and the actual persistent collection framework
and session. Does not define operations that are required for querying
collections, or loading by outer join.<br>
<br>
Implements persistence of a collection instance while the instance is
referenced in a particular role.<br>
<br>
This class is highly coupled to the <tt>PersistentCollection</tt>
hierarchy, since double dispatch is used to load and update collection
elements.<br>
<br>
May be considered an immutable view of the mapping object
<p/>
Unless a customer PersisterFactory
is used, it is expected
that implementations of CollectionDefinition define a constructor accepting the following arguments:<ol>
<li>
Collection
- The metadata about the collection to be handled
by the persister
</li>
<li>
CollectionDataAccess
- the second level caching strategy for this collection
</li>
<li>
PersisterCreationContext
- access to additional
information useful while constructing the persister.
</li>
</ol>
QueryableCollection
,
PersistentCollection
Modifier and Type | Method and Description |
---|---|
void |
deleteRows(PersistentCollection collection,
Serializable key,
SharedSessionContractImplementor session)
Delete the persistent state of any elements that were removed from
the collection
|
boolean |
elementExists(Serializable key,
Object element,
SharedSessionContractImplementor session) |
int |
getBatchSize() |
CollectionDataAccess |
getCacheAccessStrategy()
Get the cache
|
CacheEntryStructure |
getCacheEntryStructure()
Get the cache structure
|
CollectionMetadata |
getCollectionMetadata() |
Serializable[] |
getCollectionSpaces()
Get the "space" that holds the persistent state
|
CollectionType |
getCollectionType()
Get the associated <tt>Type</tt>
|
Object |
getElementByIndex(Serializable key,
Object index,
SharedSessionContractImplementor session,
Object owner) |
Class |
getElementClass()
Return the element class of an array, or null otherwise
|
String[] |
getElementColumnAliases(String suffix)
Generates the collection’s element column aliases, based on the given
suffix.
|
Type |
getElementType()
Get the "element" type
|
SessionFactoryImplementor |
getFactory() |
String |
getIdentifierColumnAlias(String suffix)
Generates the collection’s identifier column aliases, based on the given
suffix.
|
IdentifierGenerator |
getIdentifierGenerator()
Get the surrogate key generation strategy (optional operation)
|
Type |
getIdentifierType()
Get the type of the surrogate key
|
String[] |
getIndexColumnAliases(String suffix)
Generates the collection’s index column aliases, based on the given
suffix.
|
Type |
getIndexType()
Get the "index" type for a list or map (optional operation)
|
String[] |
getKeyColumnAliases(String suffix)
Generates the collection’s key column aliases, based on the given
suffix.
|
Type |
getKeyType()
Get the "key" type (the type of the foreign key)
|
String |
getManyToManyFilterFragment(String alias,
Map enabledFilters) |
String |
getMappedByProperty() |
NavigableRole |
getNavigableRole() |
EntityPersister |
getOwnerEntityPersister()
Get the persister of the entity that "owns" this collection
|
String |
getRole()
Get the name of this collection role (the fully qualified class name,
extended by a "property path")
|
int |
getSize(Serializable key,
SharedSessionContractImplementor session) |
boolean |
hasCache()
Is this collection role cacheable
|
boolean |
hasIndex()
Is this an "indexed" collection? (list or map)
|
boolean |
hasManyToManyOrdering() |
boolean |
hasOrdering()
Is this an ordered collection? (An ordered collection is
ordered by the initialization operation, not by sorting
that happens in memory, as in the case of a sorted collection.)
|
boolean |
hasOrphanDelete()
Does this collection implement "orphan delete"?
|
boolean |
indexExists(Serializable key,
Object index,
SharedSessionContractImplementor session) |
void |
initialize(Serializable key,
SharedSessionContractImplementor session)
Initialize the given collection with the given key
TODO: add owner argument!!
|
void |
insertRows(PersistentCollection collection,
Serializable key,
SharedSessionContractImplementor session)
Insert the persistent state of any new collection elements
|
boolean |
isAffectedByEnabledFilters(SharedSessionContractImplementor session) |
boolean |
isArray()
Is this an array?
|
boolean |
isCascadeDeleteEnabled()
Is cascade delete handled by the database-level
foreign key constraint definition?
|
boolean |
isExtraLazy() |
boolean |
isInverse()
Is this collection "inverse", so state changes are not
propogated to the database.
|
boolean |
isLazy()
Is this collection lazyily initialized?
|
boolean |
isManyToMany()
Is this a many-to-many association? Note that this is mainly
a convenience feature as the single persister does not
conatin all the information needed to handle a many-to-many
itself, as internally it is looked at as two many-to-ones.
|
boolean |
isMutable()
Can the elements of this collection change?
|
boolean |
isOneToMany()
Is this a one-to-many association?
|
boolean |
isPrimitiveArray()
Is this an array or primitive values?
|
boolean |
isVersioned()
Does this collection cause version increment of the
owning entity?
|
void |
postInstantiate() |
void |
processQueuedOps(PersistentCollection collection,
Serializable key,
SharedSessionContractImplementor session)
Process queued operations within the PersistentCollection.
|
Object |
readElement(ResultSet rs,
Object owner,
String[] columnAliases,
SharedSessionContractImplementor session)
Read the element from a row of the JDBC <tt>ResultSet</tt>
|
Object |
readIdentifier(ResultSet rs,
String columnAlias,
SharedSessionContractImplementor session)
Read the identifier from a row of the JDBC <tt>ResultSet</tt>
|
Object |
readIndex(ResultSet rs,
String[] columnAliases,
SharedSessionContractImplementor session)
Read the index from a row of the JDBC <tt>ResultSet</tt>
|
Object |
readKey(ResultSet rs,
String[] keyAliases,
SharedSessionContractImplementor session)
Read the key from a row of the JDBC <tt>ResultSet</tt>
|
void |
recreate(PersistentCollection collection,
Serializable key,
SharedSessionContractImplementor session)
(Re)create the collection’s persistent state
|
void |
remove(Serializable id,
SharedSessionContractImplementor session)
Completely remove the persistent state of the collection
|
void |
updateRows(PersistentCollection collection,
Serializable key,
SharedSessionContractImplementor session)
Update the persistent state of any elements that were modified
|
getCollectionPersister, getElementDefinition, getIndexDefinition
void initialize(Serializable key, SharedSessionContractImplementor session) throws HibernateException
Initialize the given collection with the given key TODO: add owner argument!!
HibernateException
boolean hasCache()
Is this collection role cacheable
CollectionDataAccess getCacheAccessStrategy()
Get the cache
NavigableRole getNavigableRole()
CacheEntryStructure getCacheEntryStructure()
Get the cache structure
CollectionType getCollectionType()
Get the associated <tt>Type</tt>
getCollectionType
in interface CollectionDefinition
Type getKeyType()
Get the "key" type (the type of the foreign key)
Type getIndexType()
Get the "index" type for a list or map (optional operation)
Type getElementType()
Get the "element" type
Class getElementClass()
Return the element class of an array, or null otherwise
Object readKey(ResultSet rs, String[] keyAliases, SharedSessionContractImplementor session) throws HibernateException, SQLException
Read the key from a row of the JDBC <tt>ResultSet</tt>
HibernateException
SQLException
Object readElement(ResultSet rs, Object owner, String[] columnAliases, SharedSessionContractImplementor session) throws HibernateException, SQLException
Read the element from a row of the JDBC <tt>ResultSet</tt>
HibernateException
SQLException
Object readIndex(ResultSet rs, String[] columnAliases, SharedSessionContractImplementor session) throws HibernateException, SQLException
Read the index from a row of the JDBC <tt>ResultSet</tt>
HibernateException
SQLException
Object readIdentifier(ResultSet rs, String columnAlias, SharedSessionContractImplementor session) throws HibernateException, SQLException
Read the identifier from a row of the JDBC <tt>ResultSet</tt>
HibernateException
SQLException
boolean isPrimitiveArray()
Is this an array or primitive values?
boolean isArray()
Is this an array?
boolean isOneToMany()
Is this a one-to-many association?
boolean isManyToMany()
Is this a many-to-many association? Note that this is mainly a convenience feature as the single persister does not conatin all the information needed to handle a many-to-many itself, as internally it is looked at as two many-to-ones.
boolean hasIndex()
Is this an "indexed" collection? (list or map)
boolean isLazy()
Is this collection lazyily initialized?
boolean isInverse()
Is this collection "inverse", so state changes are not propogated to the database.
void remove(Serializable id, SharedSessionContractImplementor session) throws HibernateException
Completely remove the persistent state of the collection
HibernateException
void recreate(PersistentCollection collection, Serializable key, SharedSessionContractImplementor session) throws HibernateException
(Re)create the collection’s persistent state
HibernateException
void deleteRows(PersistentCollection collection, Serializable key, SharedSessionContractImplementor session) throws HibernateException
Delete the persistent state of any elements that were removed from the collection
HibernateException
void updateRows(PersistentCollection collection, Serializable key, SharedSessionContractImplementor session) throws HibernateException
Update the persistent state of any elements that were modified
HibernateException
void insertRows(PersistentCollection collection, Serializable key, SharedSessionContractImplementor session) throws HibernateException
Insert the persistent state of any new collection elements
HibernateException
void processQueuedOps(PersistentCollection collection, Serializable key, SharedSessionContractImplementor session) throws HibernateException
Process queued operations within the PersistentCollection.
HibernateException
String getRole()
Get the name of this collection role (the fully qualified class name, extended by a "property path")
EntityPersister getOwnerEntityPersister()
Get the persister of the entity that "owns" this collection
IdentifierGenerator getIdentifierGenerator()
Get the surrogate key generation strategy (optional operation)
Type getIdentifierType()
Get the type of the surrogate key
boolean hasOrphanDelete()
Does this collection implement "orphan delete"?
boolean hasOrdering()
Is this an ordered collection? (An ordered collection is ordered by the initialization operation, not by sorting that happens in memory, as in the case of a sorted collection.)
boolean hasManyToManyOrdering()
Serializable[] getCollectionSpaces()
Get the "space" that holds the persistent state
CollectionMetadata getCollectionMetadata()
boolean isCascadeDeleteEnabled()
Is cascade delete handled by the database-level foreign key constraint definition?
boolean isVersioned()
Does this collection cause version increment of the owning entity?
boolean isMutable()
Can the elements of this collection change?
void postInstantiate() throws MappingException
MappingException
SessionFactoryImplementor getFactory()
boolean isAffectedByEnabledFilters(SharedSessionContractImplementor session)
String[] getKeyColumnAliases(String suffix)
Generates the collection’s key column aliases, based on the given suffix.
suffix
- The suffix to use in the key column alias generation.String[] getIndexColumnAliases(String suffix)
Generates the collection’s index column aliases, based on the given suffix.
suffix
- The suffix to use in the index column alias generation.String[] getElementColumnAliases(String suffix)
Generates the collection’s element column aliases, based on the given suffix.
suffix
- The suffix to use in the element column alias generation.String getIdentifierColumnAlias(String suffix)
Generates the collection’s identifier column aliases, based on the given suffix.
suffix
- The suffix to use in the key column alias generation.boolean isExtraLazy()
int getSize(Serializable key, SharedSessionContractImplementor session)
boolean indexExists(Serializable key, Object index, SharedSessionContractImplementor session)
boolean elementExists(Serializable key, Object element, SharedSessionContractImplementor session)
Object getElementByIndex(Serializable key, Object index, SharedSessionContractImplementor session, Object owner)
int getBatchSize()
String getMappedByProperty()
Copyright © 2001-2018 Red Hat, Inc. All Rights Reserved.