Interface CollectionPersister
- All Known Subinterfaces:
QueryableCollection,SQLLoadableCollection
- All Known Implementing Classes:
AbstractCollectionPersister,BasicCollectionPersister,OneToManyPersister
public interface CollectionPersister
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.
Implements persistence of a collection instance while the instance is referenced in a particular role.
This class is highly coupled to the PersistentCollection hierarchy, since double dispatch is used to load and update collection elements.
May be considered an immutable view of the mapping object
Implements persistence of a collection instance while the instance is referenced in a particular role.
This class is highly coupled to the PersistentCollection hierarchy, since double dispatch is used to load and update collection elements.
May be considered an immutable view of the mapping object
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteRows(PersistentCollection collection, Serializable key, SessionImplementor session) Delete the persistent state of any elements that were removed from the collectionbooleanelementExists(Serializable key, Object element, SessionImplementor session) Get the cacheGet the cache structureGet the "space" that holds the persistent stateGet the associated TypegetElementByIndex(Serializable key, Object index, SessionImplementor session, Object owner) Return the element class of an array, or null otherwiseString[]getElementColumnAliases(String suffix) Generates the collection's element column aliases, based on the given suffix.Get the "element" typegetIdentifierColumnAlias(String suffix) Generates the collection's identifier column aliases, based on the given suffix.Get the surrogate key generation strategy (optional operation)Get the type of the surrogate keyString[]getIndexColumnAliases(String suffix) Generates the collection's index column aliases, based on the given suffix.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.Get the "key" type (the type of the foreign key)getManyToManyFilterFragment(String alias, Map enabledFilters) Get the persister of the entity that "owns" this collectiongetRole()Get the name of this collection role (the fully qualified class name, extended by a "property path")intgetSize(Serializable key, SessionImplementor session) booleanhasCache()Is this collection role cacheablebooleanhasIndex()Is this an "indexed" collection? (list or map)booleanbooleanIs 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.)booleanDoes this collection implement "orphan delete"?booleanindexExists(Serializable key, Object index, SessionImplementor session) voidinitialize(Serializable key, SessionImplementor session) Initialize the given collection with the given keyvoidinsertRows(PersistentCollection collection, Serializable key, SessionImplementor session) Insert the persistent state of any new collection elementsbooleanbooleanisArray()Is this an array?booleanIs cascade delete handled by the database-level foreign key constraint definition?booleanbooleanIs this collection "inverse", so state changes are not propogated to the database.booleanisLazy()Is this collection lazyily initialized?booleanIs 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.booleanCan the elements of this collection change?booleanIs this a one-to-many association?booleanIs this an array or primitive values?booleanDoes this collection cause version increment of the owning entity?voidreadElement(ResultSet rs, Object owner, String[] columnAliases, SessionImplementor session) Read the element from a row of the JDBC ResultSetreadIdentifier(ResultSet rs, String columnAlias, SessionImplementor session) Read the identifier from a row of the JDBC ResultSetreadIndex(ResultSet rs, String[] columnAliases, SessionImplementor session) Read the index from a row of the JDBC ResultSetreadKey(ResultSet rs, String[] keyAliases, SessionImplementor session) Read the key from a row of the JDBC ResultSetvoidrecreate(PersistentCollection collection, Serializable key, SessionImplementor session) (Re)create the collection's persistent statevoidremove(Serializable id, SessionImplementor session) Completely remove the persistent state of the collectionvoidupdateRows(PersistentCollection collection, Serializable key, SessionImplementor session) Update the persistent state of any elements that were modified
-
Method Details
-
initialize
Initialize the given collection with the given key- Throws:
HibernateException
-
hasCache
boolean hasCache()Is this collection role cacheable -
getCacheAccessStrategy
CollectionRegionAccessStrategy getCacheAccessStrategy()Get the cache -
getCacheEntryStructure
CacheEntryStructure getCacheEntryStructure()Get the cache structure -
getCollectionType
CollectionType getCollectionType()Get the associated Type -
getKeyType
Type getKeyType()Get the "key" type (the type of the foreign key) -
getIndexType
Type getIndexType()Get the "index" type for a list or map (optional operation) -
getElementType
Type getElementType()Get the "element" type -
getElementClass
Class getElementClass()Return the element class of an array, or null otherwise -
readKey
Object readKey(ResultSet rs, String[] keyAliases, SessionImplementor session) throws HibernateException, SQLException Read the key from a row of the JDBC ResultSet- Throws:
HibernateExceptionSQLException
-
readElement
Object readElement(ResultSet rs, Object owner, String[] columnAliases, SessionImplementor session) throws HibernateException, SQLException Read the element from a row of the JDBC ResultSet- Throws:
HibernateExceptionSQLException
-
readIndex
Object readIndex(ResultSet rs, String[] columnAliases, SessionImplementor session) throws HibernateException, SQLException Read the index from a row of the JDBC ResultSet- Throws:
HibernateExceptionSQLException
-
readIdentifier
Object readIdentifier(ResultSet rs, String columnAlias, SessionImplementor session) throws HibernateException, SQLException Read the identifier from a row of the JDBC ResultSet- Throws:
HibernateExceptionSQLException
-
isPrimitiveArray
boolean isPrimitiveArray()Is this an array or primitive values? -
isArray
boolean isArray()Is this an array? -
isOneToMany
boolean isOneToMany()Is this a one-to-many association? -
isManyToMany
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. -
getManyToManyFilterFragment
-
hasIndex
boolean hasIndex()Is this an "indexed" collection? (list or map) -
isLazy
boolean isLazy()Is this collection lazyily initialized? -
isInverse
boolean isInverse()Is this collection "inverse", so state changes are not propogated to the database. -
remove
Completely remove the persistent state of the collection- Throws:
HibernateException
-
recreate
void recreate(PersistentCollection collection, Serializable key, SessionImplementor session) throws HibernateException (Re)create the collection's persistent state- Throws:
HibernateException
-
deleteRows
void deleteRows(PersistentCollection collection, Serializable key, SessionImplementor session) throws HibernateException Delete the persistent state of any elements that were removed from the collection- Throws:
HibernateException
-
updateRows
void updateRows(PersistentCollection collection, Serializable key, SessionImplementor session) throws HibernateException Update the persistent state of any elements that were modified- Throws:
HibernateException
-
insertRows
void insertRows(PersistentCollection collection, Serializable key, SessionImplementor session) throws HibernateException Insert the persistent state of any new collection elements- Throws:
HibernateException
-
getRole
String getRole()Get the name of this collection role (the fully qualified class name, extended by a "property path") -
getOwnerEntityPersister
EntityPersister getOwnerEntityPersister()Get the persister of the entity that "owns" this collection -
getIdentifierGenerator
IdentifierGenerator getIdentifierGenerator()Get the surrogate key generation strategy (optional operation) -
getIdentifierType
Type getIdentifierType()Get the type of the surrogate key -
hasOrphanDelete
boolean hasOrphanDelete()Does this collection implement "orphan delete"? -
hasOrdering
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.) -
hasManyToManyOrdering
boolean hasManyToManyOrdering() -
getCollectionSpaces
Serializable[] getCollectionSpaces()Get the "space" that holds the persistent state -
getCollectionMetadata
CollectionMetadata getCollectionMetadata() -
isCascadeDeleteEnabled
boolean isCascadeDeleteEnabled()Is cascade delete handled by the database-level foreign key constraint definition? -
isVersioned
boolean isVersioned()Does this collection cause version increment of the owning entity? -
isMutable
boolean isMutable()Can the elements of this collection change? -
getNodeName
String getNodeName() -
getElementNodeName
String getElementNodeName() -
getIndexNodeName
String getIndexNodeName() -
postInstantiate
- Throws:
MappingException
-
getFactory
SessionFactoryImplementor getFactory() -
isAffectedByEnabledFilters
-
getKeyColumnAliases
Generates the collection's key column aliases, based on the given suffix.- Parameters:
suffix- The suffix to use in the key column alias generation.- Returns:
- The key column aliases.
-
getIndexColumnAliases
Generates the collection's index column aliases, based on the given suffix.- Parameters:
suffix- The suffix to use in the index column alias generation.- Returns:
- The key column aliases, or null if not indexed.
-
getElementColumnAliases
Generates the collection's element column aliases, based on the given suffix.- Parameters:
suffix- The suffix to use in the element column alias generation.- Returns:
- The key column aliases.
-
getIdentifierColumnAlias
Generates the collection's identifier column aliases, based on the given suffix.- Parameters:
suffix- The suffix to use in the key column alias generation.- Returns:
- The key column aliases.
-
isExtraLazy
boolean isExtraLazy() -
getSize
-
indexExists
-
elementExists
-
getElementByIndex
-