Top Description Methods
org.hibernate.persister.collection

public Interface CollectionPersister

extends CollectionDefinition
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.spi.access.CollectionDataAccess, org.hibernate.cache.spi.entry.CacheEntryStructure, org.hibernate.collection.spi.PersistentCollection, org.hibernate.engine.spi.SessionFactoryImplementor, .SharedSessionContractImplementor, org.hibernate.id.IdentifierGenerator, org.hibernate.metadata.CollectionMetadata, org.hibernate.metamodel.model.domain.NavigableRole, org.hibernate.persister.entity.EntityPersister, org.hibernate.persister.walking.spi.CollectionDefinition, 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

Unless a customer org.hibernate.persister.spi.PersisterFactory is used, it is expected that implementations of CollectionDefinition define a constructor accepting the following arguments:

  1. org.hibernate.mapping.Collection - The metadata about the collection to be handled by the persister
  2. CollectionDataAccess - the second level caching strategy for this collection
  3. org.hibernate.persister.spi.PersisterCreationContext - access to additional information useful while constructing the persister.
Author
Gavin King
See Also
QueryableCollection, org.hibernate.collection.spi.PersistentCollection

Method Summary

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

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

public boolean
public int
public CollectionDataAccess
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
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 Type
getElementType()

Get the "element" type

public SessionFactoryImplementor
getFactory()

Deprecated as a consequence of SessionFactoryImplementor being deprecated.
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()

Deprecated as a consequence of IdentifierGenerator being deprecated.
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 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

Returns:

the name of the property this collection is mapped by
getMappedByProperty
()

public NavigableRole
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, SharedSessionContractImplementor session)

Initialize the given collection with the given key TODO: add owner argument!!

public void
insertRows(PersistentCollection collection, Serializable key, SharedSessionContractImplementor 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 propagated 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 void
processQueuedOps(PersistentCollection collection, Serializable key, SharedSessionContractImplementor session)

Process queued operations within the PersistentCollection.

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

Read the element from a row of the JDBC ResultSet

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

Read the identifier from a row of the JDBC ResultSet

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

Read the index from a row of the JDBC ResultSet

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

Read the key from a row of the JDBC ResultSet

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

(Re)create the collection's persistent state

public void
remove(Serializable id, SharedSessionContractImplementor session)

Completely remove the persistent state of the collection

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

Update the persistent state of any elements that were modified

Inherited from org.hibernate.persister.walking.spi.CollectionDefinition:
getCollectionPersistergetElementDefinitiongetIndexDefinition

Method Detail

deleteRowsback to summary
public void deleteRows(PersistentCollection collection, Serializable key, SharedSessionContractImplementor 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, SharedSessionContractImplementor session)
getBatchSizeback to summary
public int getBatchSize()
getCacheAccessStrategyback to summary
public CollectionDataAccess 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()

Redeclares org.hibernate.persister.walking.spi.CollectionDefinition.getCollectionType.

Get the associated Type

getElementByIndexback to summary
public Object getElementByIndex(Serializable key, Object index, SharedSessionContractImplementor 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.

getElementTypeback to summary
public Type getElementType()

Get the "element" type

getFactoryback to summary
public SessionFactoryImplementor getFactory()

Deprecated

as a consequence of SessionFactoryImplementor being deprecated. See corresponding docs for further information.

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()

Deprecated

as a consequence of IdentifierGenerator being deprecated. See corresponding docs for further information.

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.

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)
getMappedByPropertyback to summary
public String getMappedByProperty()
Returns:String

the name of the property this collection is mapped by

getNavigableRoleback to summary
public NavigableRole getNavigableRole()
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, SharedSessionContractImplementor 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, SharedSessionContractImplementor session)
initializeback to summary
public void initialize(Serializable key, SharedSessionContractImplementor session) throws HibernateException

Initialize the given collection with the given key TODO: add owner argument!!

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

Insert the persistent state of any new collection elements

isAffectedByEnabledFiltersback to summary
public boolean isAffectedByEnabledFilters(SharedSessionContractImplementor 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 propagated 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 contain 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
processQueuedOpsback to summary
public void processQueuedOps(PersistentCollection collection, Serializable key, SharedSessionContractImplementor session) throws HibernateException

Process queued operations within the PersistentCollection.

readElementback to summary
public Object readElement(ResultSet rs, Object owner, String[] columnAliases, SharedSessionContractImplementor session) throws HibernateException, SQLException

Read the element from a row of the JDBC ResultSet

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

Read the identifier from a row of the JDBC ResultSet

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

Read the index from a row of the JDBC ResultSet

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

Read the key from a row of the JDBC ResultSet

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

(Re)create the collection's persistent state

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

Completely remove the persistent state of the collection

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

Update the persistent state of any elements that were modified