org.hibernate.loader.collection
Class CollectionLoader

java.lang.Object
  extended byorg.hibernate.loader.Loader
      extended byorg.hibernate.loader.BasicLoader
          extended byorg.hibernate.loader.OuterJoinLoader
              extended byorg.hibernate.loader.collection.CollectionLoader
All Implemented Interfaces:
CollectionInitializer
Direct Known Subclasses:
SubselectCollectionLoader

public class CollectionLoader
extends OuterJoinLoader
implements CollectionInitializer

Loads a collection of values or a many-to-many association.
The collection persister must implement QueryableCOllection. For other collections, create a customized subclass of Loader.

Author:
Gavin King
See Also:
OneToManyLoader

Field Summary
 
Fields inherited from class org.hibernate.loader.OuterJoinLoader
aliases, collectionOwners, collectionPersisters, collectionSuffixes, lockModeArray, ownerAssociationType, owners, persisters, sql, suffixes
 
Fields inherited from class org.hibernate.loader.BasicLoader
NO_SUFFIX
 
Constructor Summary
CollectionLoader(QueryableCollection collectionPersister, int batchSize, SessionFactoryImplementor factory, Map enabledFilters)
           
CollectionLoader(QueryableCollection collectionPersister, int batchSize, String subquery, SessionFactoryImplementor factory, Map enabledFilters)
           
CollectionLoader(QueryableCollection collectionPersister, SessionFactoryImplementor session, Map enabledFilters)
           
 
Method Summary
protected  int getJoinType(AssociationType type, FetchMode config, String path, Set visitedAssociations, String lhsTable, String[] lhsColumns, boolean nullable, int currentDepth)
          We can use an inner join for first many-to-many association
protected  Type getKeyType()
           
 void initialize(Serializable id, SessionImplementor session)
          Initialize the given collection
protected  boolean isSubselectLoadingEnabled()
           
 String toString()
           
 
Methods inherited from class org.hibernate.loader.OuterJoinLoader
countCollectionPersisters, countEntityPersisters, generateRootAlias, generateTableAlias, getAliases, getCollectionOwners, getCollectionPersisters, getCollectionSuffixes, getDialect, getEnabledFilters, getEntityPersisters, getJoinType, getLockModes, getOwnerAssociationTypes, getOwners, getSQLString, getSuffixes, initPersisters, isDuplicateAssociation, isDuplicateAssociation, isJoinable, isJoinedFetchEnabled, isJoinedFetchEnabledInMapping, isTooDeep, mergeOuterJoins, orderBy, orderBy, selectString, walkCollectionTree, walkEntityTree, whereString
 
Methods inherited from class org.hibernate.loader.BasicLoader
generateSuffixes, generateSuffixes, getCollectionAliases, getEntityAliases, postInstantiate
 
Methods inherited from class org.hibernate.loader.Loader
applyLocks, bindNamedParameters, bindPositionalParameters, doList, getEntityEagerPropertyFetches, getFactory, getQueryIdentifier, getResultColumnOrRow, getResultList, getResultSet, getResultSet, hasSubselectLoadableCollections, isSingleRowLoader, list, loadCollection, loadCollectionBatch, loadCollectionSubselect, loadEntity, loadEntityBatch, loadSingleRow, prepareQueryStatement, preprocessSQL, scroll, upgradeLocks
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CollectionLoader

public CollectionLoader(QueryableCollection collectionPersister,
                        SessionFactoryImplementor session,
                        Map enabledFilters)
                 throws MappingException

CollectionLoader

public CollectionLoader(QueryableCollection collectionPersister,
                        int batchSize,
                        SessionFactoryImplementor factory,
                        Map enabledFilters)
                 throws MappingException

CollectionLoader

public CollectionLoader(QueryableCollection collectionPersister,
                        int batchSize,
                        String subquery,
                        SessionFactoryImplementor factory,
                        Map enabledFilters)
                 throws MappingException
Method Detail

initialize

public void initialize(Serializable id,
                       SessionImplementor session)
                throws HibernateException
Description copied from interface: CollectionInitializer
Initialize the given collection

Specified by:
initialize in interface CollectionInitializer
Throws:
HibernateException

getJoinType

protected int getJoinType(AssociationType type,
                          FetchMode config,
                          String path,
                          Set visitedAssociations,
                          String lhsTable,
                          String[] lhsColumns,
                          boolean nullable,
                          int currentDepth)
                   throws MappingException
We can use an inner join for first many-to-many association

Overrides:
getJoinType in class OuterJoinLoader
Throws:
MappingException

getKeyType

protected Type getKeyType()

toString

public String toString()
Overrides:
toString in class Loader

isSubselectLoadingEnabled

protected boolean isSubselectLoadingEnabled()
Overrides:
isSubselectLoadingEnabled in class Loader