org.hibernate.loader.criteria
Class CriteriaLoader

java.lang.Object
  extended byorg.hibernate.loader.Loader
      extended byorg.hibernate.loader.BasicLoader
          extended byorg.hibernate.loader.OuterJoinLoader
              extended byorg.hibernate.loader.AbstractEntityLoader
                  extended byorg.hibernate.loader.criteria.CriteriaLoader

public class CriteriaLoader
extends AbstractEntityLoader

A Loader for Criteria queries. Note that criteria queries are more like multi-object load()s than like HQL queries.

Author:
Gavin King

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
CriteriaLoader(OuterJoinLoadable persister, SessionFactoryImplementor factory, CriteriaImpl criteria, String rootEntityName, Map enabledFilters)
           
 
Method Summary
protected  String applyLocks(String sqlSelectString, Map lockModes, Dialect dialect)
          Append FOR UPDATE OF clause, if necessary.
protected  String generateRootAlias(String tableName)
           
protected  String generateTableAlias(int n, String path, Joinable joinable)
           
 String getComment()
           
protected  int getJoinType(AssociationType type, FetchMode config, String path, Set visitedAssociations, String lhsTable, String[] lhsColumns, boolean nullable, int currentDepth)
          Get the join type (inner, outer, etc) or -1 if the association should not be joined.
protected  LockMode[] getLockModes(Map lockModes)
          What lock mode does this load entities with?
 Set getQuerySpaces()
           
protected  Object getResultColumnOrRow(Object[] row, ResultSet rs, SessionImplementor session)
          Get the actual object that is returned in the user-visible result list.
protected  List getResultList(List results)
           
protected  String getWhereFragment()
          Use the discriminator, to narrow the select to instances of the queried subclass, also applying any filters.
protected  boolean isSubselectLoadingEnabled()
           
 List list(SessionImplementor session)
           
 ScrollableResults scroll(SessionImplementor session, ScrollMode scrollMode)
           
 
Methods inherited from class org.hibernate.loader.AbstractEntityLoader
getAlias, getPersister, initAll, initProjection, isJoinedFetchEnabled, toString
 
Methods inherited from class org.hibernate.loader.OuterJoinLoader
countCollectionPersisters, countEntityPersisters, getAliases, getCollectionOwners, getCollectionPersisters, getCollectionSuffixes, getDialect, getEnabledFilters, getEntityPersisters, getJoinType, getOwnerAssociationTypes, getOwners, getSQLString, getSuffixes, initPersisters, isDuplicateAssociation, isDuplicateAssociation, isJoinable, 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
bindNamedParameters, bindPositionalParameters, doList, getEntityEagerPropertyFetches, getFactory, getQueryIdentifier, 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

CriteriaLoader

public CriteriaLoader(OuterJoinLoadable persister,
                      SessionFactoryImplementor factory,
                      CriteriaImpl criteria,
                      String rootEntityName,
                      Map enabledFilters)
               throws HibernateException
Method Detail

scroll

public ScrollableResults scroll(SessionImplementor session,
                                ScrollMode scrollMode)
                         throws HibernateException
Throws:
HibernateException

list

public List list(SessionImplementor session)
          throws HibernateException
Throws:
HibernateException

getResultColumnOrRow

protected Object getResultColumnOrRow(Object[] row,
                                      ResultSet rs,
                                      SessionImplementor session)
                               throws SQLException,
                                      HibernateException
Description copied from class: Loader
Get the actual object that is returned in the user-visible result list. This empty implementation merely returns its first argument. This is overridden by some subclasses.

Overrides:
getResultColumnOrRow in class Loader
Throws:
SQLException
HibernateException

getJoinType

protected int getJoinType(AssociationType type,
                          FetchMode config,
                          String path,
                          Set visitedAssociations,
                          String lhsTable,
                          String[] lhsColumns,
                          boolean nullable,
                          int currentDepth)
                   throws MappingException
Description copied from class: OuterJoinLoader
Get the join type (inner, outer, etc) or -1 if the association should not be joined. Override on subclasses.

Overrides:
getJoinType in class OuterJoinLoader
Throws:
MappingException

getWhereFragment

protected String getWhereFragment()
                           throws MappingException
Use the discriminator, to narrow the select to instances of the queried subclass, also applying any filters.

Overrides:
getWhereFragment in class AbstractEntityLoader
Throws:
MappingException

generateTableAlias

protected String generateTableAlias(int n,
                                    String path,
                                    Joinable joinable)
Overrides:
generateTableAlias in class OuterJoinLoader

generateRootAlias

protected String generateRootAlias(String tableName)
Overrides:
generateRootAlias in class OuterJoinLoader

getQuerySpaces

public Set getQuerySpaces()

applyLocks

protected String applyLocks(String sqlSelectString,
                            Map lockModes,
                            Dialect dialect)
                     throws QueryException
Description copied from class: Loader
Append FOR UPDATE OF clause, if necessary. This empty superclass implementation merely returns its first argument.

Overrides:
applyLocks in class Loader
Throws:
QueryException

getLockModes

protected LockMode[] getLockModes(Map lockModes)
Description copied from class: Loader
What lock mode does this load entities with?

Overrides:
getLockModes in class OuterJoinLoader

isSubselectLoadingEnabled

protected boolean isSubselectLoadingEnabled()
Overrides:
isSubselectLoadingEnabled in class Loader

getResultList

protected List getResultList(List results)
Overrides:
getResultList in class Loader

getComment

public String getComment()
Specified by:
getComment in class AbstractEntityLoader