org.hibernate.persister.collection

Class BasicCollectionPersister

Implemented Interfaces:
CollectionMetadata, CollectionPersister, Joinable, PropertyMapping, QueryableCollection, SQLLoadableCollection

public class BasicCollectionPersister
extends AbstractCollectionPersister

Collection persister for collections of values and many-to-many associations.
Author:
Gavin King

Field Summary

Fields inherited from class org.hibernate.persister.collection.AbstractCollectionPersister

batchSize, elementColumnAliases, elementColumnIsInPrimaryKey, elementColumnIsSettable, elementColumnNames, elementFormulaTemplates, elementFormulas, elementIsPureFormula, elementType, hasIdentifier, hasIndex, hasWhere, identifierColumnName, indexColumnAliases, indexColumnIsSettable, indexColumnNames, indexContainsFormula, indexFormulaTemplates, indexFormulas, keyColumnAliases, keyColumnNames, qualifiedTableName, sqlWhereString

Constructor Summary

BasicCollectionPersister(Collection collection, CollectionRegionAccessStrategy cacheAccessStrategy, Configuration cfg, SessionFactoryImplementor factory)

Method Summary

boolean
consumesCollectionAlias()
Very, very, very ugly...
boolean
consumesEntityAlias()
Very, very, very ugly...
protected CollectionInitializer
createCollectionInitializer(java.util.Map enabledFilters)
Create the CollectionLoader
protected CollectionInitializer
createSubselectInitializer(SubselectFetch subselect, SessionImplementor session)
protected int
doUpdateRows(Serializable id, PersistentCollection collection, SessionImplementor session)
String
fromJoinFragment(String alias, boolean innerJoin, boolean includeSubclasses)
Get the from clause part of any joins (optional operation)
protected String
generateDeleteRowString()
Generate the SQL DELETE that deletes a particular row
protected String
generateDeleteString()
Generate the SQL DELETE that deletes all rows
protected String
generateInsertRowString()
Generate the SQL INSERT that creates a new row
protected String
generateUpdateRowString()
Generate the SQL UPDATE that updates a row
boolean
isCascadeDeleteEnabled()
Is cascade delete handled by the database-level foreign key constraint definition?
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
isOneToMany()
Is this a one-to-many association?
String
selectFragment(Joinable rhs, String rhsAlias, String lhsAlias, String entitySuffix, String collectionSuffix, boolean includeCollectionColumns)
All columns to select, when loading.
String
whereJoinFragment(String alias, boolean innerJoin, boolean includeSubclasses)
Get the where clause part of any joins (optional operation)

Methods inherited from class org.hibernate.persister.collection.AbstractCollectionPersister

appendElementColumns, appendIdentifierColumns, appendIndexColumns, createCollectionInitializer, createSubselectInitializer, decrementIndexByBase, deleteRows, doUpdateRows, elementExists, filterFragment, filterFragment, generateDeleteRowString, generateDeleteString, generateDetectRowByElementString, generateDetectRowByIndexString, generateInsertRowString, generateSelectFragment, generateSelectRowByIndexString, generateSelectSizeString, generateUpdateRowString, getAppropriateInitializer, getCacheAccessStrategy, getCacheEntryStructure, getCollectionMetadata, getCollectionPropertyColumnAliases, getCollectionSpaces, getCollectionType, getDeleteAllCheckStyle, getDeleteCheckStyle, getDialect, getElementByIndex, getElementClass, getElementColumnAliases, getElementColumnNames, getElementColumnNames, getElementNodeName, getElementPersister, getElementType, getFactory, getFetchMode, getIdentifierColumnAlias, getIdentifierColumnName, getIdentifierGenerator, getIdentifierType, getIndexColumnAliases, getIndexColumnNames, getIndexColumnNames, getIndexFormulas, getIndexNodeName, getIndexType, getInsertCheckStyle, getKeyColumnAliases, getKeyColumnNames, getKeyType, getManyToManyFilterFragment, getManyToManyOrderByString, getName, getNodeName, getOwnerEntityName, getOwnerEntityPersister, getRole, getSQLDeleteRowString, getSQLDeleteString, getSQLExceptionConverter, getSQLInsertRowString, getSQLOrderByString, getSQLUpdateRowString, getSQLWhereString, getSize, getTableName, getType, getUpdateCheckStyle, hasCache, hasIndex, hasManyToManyOrdering, hasOrdering, hasOrphanDelete, hasWhere, incrementIndexByBase, indexExists, initCollectionPropertyMap, initialize, insertRows, isAffectedByEnabledFilters, isArray, isCollection, isDeleteAllCallable, isDeleteCallable, isExtraLazy, isInsertCallable, isInverse, isLazy, isManyToMany, isMutable, isPrimitiveArray, isRowDeleteEnabled, isRowInsertEnabled, isSubselectLoadable, isUpdateCallable, isVersioned, logStaticSQL, oneToManyFilterFragment, postInstantiate, readElement, readIdentifier, readIndex, readKey, recreate, remove, selectFragment, toColumns, toColumns, toString, toType, updateRows, writeElement, writeElementToWhere, writeIdentifier, writeIndex, writeIndexToWhere, writeKey

Constructor Details

BasicCollectionPersister

public BasicCollectionPersister(Collection collection,
                                CollectionRegionAccessStrategy cacheAccessStrategy,
                                Configuration cfg,
                                SessionFactoryImplementor factory)
            throws MappingException,
                   CacheException

Method Details

consumesCollectionAlias

public boolean consumesCollectionAlias()
Very, very, very ugly...
Specified by:
consumesCollectionAlias in interface Joinable
Returns:
Does this persister "consume" collection column aliases in the result set?

consumesEntityAlias

public boolean consumesEntityAlias()
Very, very, very ugly...
Specified by:
consumesEntityAlias in interface Joinable
Returns:
Does this persister "consume" entity column aliases in the result set?

createCollectionInitializer

protected CollectionInitializer createCollectionInitializer(java.util.Map enabledFilters)
            throws MappingException
Create the CollectionLoader

createSubselectInitializer

protected CollectionInitializer createSubselectInitializer(SubselectFetch subselect,
                                                           SessionImplementor session)
Overrides:
createSubselectInitializer in interface AbstractCollectionPersister

doUpdateRows

protected int doUpdateRows(Serializable id,
                           PersistentCollection collection,
                           SessionImplementor session)
            throws HibernateException
Overrides:
doUpdateRows in interface AbstractCollectionPersister

fromJoinFragment

public String fromJoinFragment(String alias,
                               boolean innerJoin,
                               boolean includeSubclasses)
Get the from clause part of any joins (optional operation)
Specified by:
fromJoinFragment in interface Joinable

generateDeleteRowString

protected String generateDeleteRowString()
Generate the SQL DELETE that deletes a particular row
Overrides:
generateDeleteRowString in interface AbstractCollectionPersister

generateDeleteString

protected String generateDeleteString()
Generate the SQL DELETE that deletes all rows
Overrides:
generateDeleteString in interface AbstractCollectionPersister

generateInsertRowString

protected String generateInsertRowString()
Generate the SQL INSERT that creates a new row
Overrides:
generateInsertRowString in interface AbstractCollectionPersister

generateUpdateRowString

protected String generateUpdateRowString()
Generate the SQL UPDATE that updates a row
Overrides:
generateUpdateRowString in interface AbstractCollectionPersister

isCascadeDeleteEnabled

public boolean isCascadeDeleteEnabled()
Is cascade delete handled by the database-level foreign key constraint definition?
Specified by:
isCascadeDeleteEnabled in interface CollectionPersister

isManyToMany

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.
Specified by:
isManyToMany in interface CollectionPersister
Overrides:
isManyToMany in interface AbstractCollectionPersister

isOneToMany

public boolean isOneToMany()
Is this a one-to-many association?
Specified by:
isOneToMany in interface CollectionPersister

selectFragment

public String selectFragment(Joinable rhs,
                             String rhsAlias,
                             String lhsAlias,
                             String entitySuffix,
                             String collectionSuffix,
                             boolean includeCollectionColumns)
All columns to select, when loading.
Specified by:
selectFragment in interface Joinable

whereJoinFragment

public String whereJoinFragment(String alias,
                                boolean innerJoin,
                                boolean includeSubclasses)
Get the where clause part of any joins (optional operation)
Specified by:
whereJoinFragment in interface Joinable