Top Description Methods
org.hibernate.persister.collection

public Interface CollectionPersister

Known Direct Subinterfaces
org.hibernate.persister.collection.QueryableCollection
Imports
java.io.Serializable, java.sql.ResultSet, .SQLException, java.util.Map, org.hibernate.HibernateException, .MappingException, org.hibernate.cache.access.CollectionRegionAccessStrategy, org.hibernate.cache.entry.CacheEntryStructure, org.hibernate.collection.PersistentCollection, org.hibernate.engine.SessionFactoryImplementor, .SessionImplementor, org.hibernate.id.IdentifierGenerator, org.hibernate.metadata.CollectionMetadata, org.hibernate.persister.entity.EntityPersister, org.hibernate.type.CollectionType, .Type

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
Author
Gavin King
See Also
QueryableCollection, PersistentCollection

Method Summary

Modifier and TypeMethod and Description
public void
deleteRows(PersistentCollection collection, Serializable key, SessionImplementor session)

Delete the persistent state of any elements that were removed from the collection

public boolean
public CollectionRegionAccessStrategy
getCacheAccessStrategy()

Get the cache

public CacheEntryStructure
getCacheEntryStructure()

Get the cache structure

public CollectionMetadata
public Serializable[]
getCollectionSpaces()

Get the "space" that holds the persistent state

public CollectionType
getCollectionType()

Get the associated Type

public Object
public Class<T>
getElementClass()

Return the element class of an array, or null otherwise

public String[]

Returns:

The key column aliases.
getElementColumnAliases
(String
The suffix to use in the element column alias generation.
suffix
)

Generates the collection's element column aliases, based on the given suffix.

public String
public Type
getElementType()

Get the "element" type

public SessionFactoryImplementor
public String

Returns:

The key column aliases.
getIdentifierColumnAlias
(String
The suffix to use in the key column alias generation.
suffix
)

Generates the collection's identifier column aliases, based on the given suffix.

public IdentifierGenerator
getIdentifierGenerator()

Get the surrogate key generation strategy (optional operation)

public Type
getIdentifierType()

Get the type of the surrogate key

public String[]

Returns:

The key column aliases, or null if not indexed.
getIndexColumnAliases
(String
The suffix to use in the index column alias generation.
suffix
)

Generates the collection's index column aliases, based on the given suffix.

public String
public Type
getIndexType()

Get the "index" type for a list or map (optional operation)

public String[]

Returns:

The key column aliases.
getKeyColumnAliases
(String
The suffix to use in the key column alias generation.
suffix
)

Generates the collection's key column aliases, based on the given suffix.

public Type
getKeyType()

Get the "key" type (the type of the foreign key)

public String
getManyToManyFilterFragment(String alias, Map<K, V> enabledFilters)

public String
public EntityPersister
getOwnerEntityPersister()

Get the persister of the entity that "owns" this collection

public String
getRole()

Get the name of this collection role (the fully qualified class name, extended by a "property path")

public int
public boolean
hasCache()

Is this collection role cacheable

public boolean
hasIndex()

Is this an "indexed" collection?

public boolean
public boolean
hasOrdering()

Is this an ordered collection?

public boolean
hasOrphanDelete()

Does this collection implement "orphan delete"?

public boolean
public void
initialize(Serializable key, SessionImplementor session)

Initialize the given collection with the given key

public void
insertRows(PersistentCollection collection, Serializable key, SessionImplementor session)

Insert the persistent state of any new collection elements

public boolean
public boolean
isArray()

Is this an array?

public boolean
isCascadeDeleteEnabled()

Is cascade delete handled by the database-level foreign key constraint definition?

public boolean
public boolean
isInverse()

Is this collection "inverse", so state changes are not propogated to the database.

public boolean
isLazy()

Is this collection lazyily initialized?

public boolean
isManyToMany()

Is this a many-to-many association?

public boolean
isMutable()

Can the elements of this collection change?

public boolean
isOneToMany()

Is this a one-to-many association?

public boolean
isPrimitiveArray()

Is this an array or primitive values?

public boolean
isVersioned()

Does this collection cause version increment of the owning entity?

public void
public Object
readElement(ResultSet rs, Object owner, String[] columnAliases, SessionImplementor session)

Read the element from a row of the JDBC ResultSet

public Object
readIdentifier(ResultSet rs, String columnAlias, SessionImplementor session)

Read the identifier from a row of the JDBC ResultSet

public Object
readIndex(ResultSet rs, String[] columnAliases, SessionImplementor session)

Read the index from a row of the JDBC ResultSet

public Object
readKey(ResultSet rs, String[] keyAliases, SessionImplementor session)

Read the key from a row of the JDBC ResultSet

public void
recreate(PersistentCollection collection, Serializable key, SessionImplementor session)

(Re)create the collection's persistent state

public void
remove(Serializable id, SessionImplementor session)

Completely remove the persistent state of the collection

public void
updateRows(PersistentCollection collection, Serializable key, SessionImplementor session)

Update the persistent state of any elements that were modified

Method Detail

deleteRowsback to summary
public void deleteRows(PersistentCollection collection, Serializable key, SessionImplementor session) throws HibernateException

Delete the persistent state of any elements that were removed from the collection

elementExistsback to summary
public boolean elementExists(Serializable key, Object element, SessionImplementor session)
getCacheAccessStrategyback to summary
public CollectionRegionAccessStrategy getCacheAccessStrategy()

Get the cache

getCacheEntryStructureback to summary
public CacheEntryStructure getCacheEntryStructure()

Get the cache structure

getCollectionMetadataback to summary
public CollectionMetadata getCollectionMetadata()
getCollectionSpacesback to summary
public Serializable[] getCollectionSpaces()

Get the "space" that holds the persistent state

getCollectionTypeback to summary
public CollectionType getCollectionType()

Get the associated Type

getElementByIndexback to summary
public Object getElementByIndex(Serializable key, Object index, SessionImplementor session, Object owner)
getElementClassback to summary
public Class<T> getElementClass()

Return the element class of an array, or null otherwise

getElementColumnAliasesback to summary
public String[] getElementColumnAliases(String suffix)

Generates the collection's element column aliases, based on the given suffix.

Parameters
suffix:String

The suffix to use in the element column alias generation.

Returns:String[]

The key column aliases.

getElementNodeNameback to summary
public String getElementNodeName()
getElementTypeback to summary
public Type getElementType()

Get the "element" type

getFactoryback to summary
public SessionFactoryImplementor getFactory()
getIdentifierColumnAliasback to summary
public String getIdentifierColumnAlias(String suffix)

Generates the collection's identifier column aliases, based on the given suffix.

Parameters
suffix:String

The suffix to use in the key column alias generation.

Returns:String

The key column aliases.

getIdentifierGeneratorback to summary
public IdentifierGenerator getIdentifierGenerator()

Get the surrogate key generation strategy (optional operation)

getIdentifierTypeback to summary
public Type getIdentifierType()

Get the type of the surrogate key

getIndexColumnAliasesback to summary
public String[] getIndexColumnAliases(String suffix)

Generates the collection's index column aliases, based on the given suffix.

Parameters
suffix:String

The suffix to use in the index column alias generation.

Returns:String[]

The key column aliases, or null if not indexed.

getIndexNodeNameback to summary
public String getIndexNodeName()
getIndexTypeback to summary
public Type getIndexType()

Get the "index" type for a list or map (optional operation)

getKeyColumnAliasesback to summary
public String[] getKeyColumnAliases(String suffix)

Generates the collection's key column aliases, based on the given suffix.

Parameters
suffix:String

The suffix to use in the key column alias generation.

Returns:String[]

The key column aliases.

getKeyTypeback to summary
public Type getKeyType()

Get the "key" type (the type of the foreign key)

getManyToManyFilterFragmentback to summary
public String getManyToManyFilterFragment(String alias, Map<K, V> enabledFilters)
getNodeNameback to summary
public String getNodeName()
getOwnerEntityPersisterback to summary
public EntityPersister getOwnerEntityPersister()

Get the persister of the entity that "owns" this collection

getRoleback to summary
public String getRole()

Get the name of this collection role (the fully qualified class name, extended by a "property path")

getSizeback to summary
public int getSize(Serializable key, SessionImplementor session)
hasCacheback to summary
public boolean hasCache()

Is this collection role cacheable

hasIndexback to summary
public boolean hasIndex()

Is this an "indexed" collection? (list or map)

hasManyToManyOrderingback to summary
public boolean hasManyToManyOrdering()
hasOrderingback to summary
public 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.)

hasOrphanDeleteback to summary
public boolean hasOrphanDelete()

Does this collection implement "orphan delete"?

indexExistsback to summary
public boolean indexExists(Serializable key, Object index, SessionImplementor session)
initializeback to summary
public void initialize(Serializable key, SessionImplementor session) throws HibernateException

Initialize the given collection with the given key

insertRowsback to summary
public void insertRows(PersistentCollection collection, Serializable key, SessionImplementor session) throws HibernateException

Insert the persistent state of any new collection elements

isAffectedByEnabledFiltersback to summary
public boolean isAffectedByEnabledFilters(SessionImplementor session)
isArrayback to summary
public boolean isArray()

Is this an array?

isCascadeDeleteEnabledback to summary
public boolean isCascadeDeleteEnabled()

Is cascade delete handled by the database-level foreign key constraint definition?

isExtraLazyback to summary
public boolean isExtraLazy()
isInverseback to summary
public boolean isInverse()

Is this collection "inverse", so state changes are not propogated to the database.

isLazyback to summary
public boolean isLazy()

Is this collection lazyily initialized?

isManyToManyback to summary
public 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.

isMutableback to summary
public boolean isMutable()

Can the elements of this collection change?

isOneToManyback to summary
public boolean isOneToMany()

Is this a one-to-many association?

isPrimitiveArrayback to summary
public boolean isPrimitiveArray()

Is this an array or primitive values?

isVersionedback to summary
public boolean isVersioned()

Does this collection cause version increment of the owning entity?

postInstantiateback to summary
public void postInstantiate() throws MappingException
readElementback to summary
public Object readElement(ResultSet rs, Object owner, String[] columnAliases, SessionImplementor session) throws HibernateException, SQLException

Read the element from a row of the JDBC ResultSet

readIdentifierback to summary
public Object readIdentifier(ResultSet rs, String columnAlias, SessionImplementor session) throws HibernateException, SQLException

Read the identifier from a row of the JDBC ResultSet

readIndexback to summary
public Object readIndex(ResultSet rs, String[] columnAliases, SessionImplementor session) throws HibernateException, SQLException

Read the index from a row of the JDBC ResultSet

readKeyback to summary
public Object readKey(ResultSet rs, String[] keyAliases, SessionImplementor session) throws HibernateException, SQLException

Read the key from a row of the JDBC ResultSet

recreateback to summary
public void recreate(PersistentCollection collection, Serializable key, SessionImplementor session) throws HibernateException

(Re)create the collection's persistent state

removeback to summary
public void remove(Serializable id, SessionImplementor session) throws HibernateException

Completely remove the persistent state of the collection

updateRowsback to summary
public void updateRows(PersistentCollection collection, Serializable key, SessionImplementor session) throws HibernateException

Update the persistent state of any elements that were modified