org.hibernate.loader.hql
Class QueryLoader

java.lang.Object
  extended byorg.hibernate.loader.Loader
      extended byorg.hibernate.loader.BasicLoader
          extended byorg.hibernate.loader.hql.QueryLoader

public class QueryLoader
extends BasicLoader

A delegate that implements the Loader part of QueryTranslator.

User: josh Date: Jan 3, 2004 Time: 8:29:58 PM


Field Summary
 
Fields inherited from class org.hibernate.loader.BasicLoader
NO_SUFFIX
 
Constructor Summary
QueryLoader(QueryTranslator queryTranslator, SessionFactoryImplementor factory, SelectClause selectClause)
          Creates a new Loader implementation.
 
Method Summary
protected  String applyLocks(String sql, Map lockModes, Dialect dialect)
          Append FOR UPDATE OF clause, if necessary.
protected  int bindNamedParameters(PreparedStatement ps, Map namedParams, int start, SessionImplementor session)
          Bind named parameters to the PreparedStatement.
 String[] getAliases()
          Get the SQL table aliases of entities whose associations are subselect-loadable, returning null if this loader does not support subselect loading
protected  int[] getCollectionOwners()
          Get the index of the entity that owns the collection, or -1 if there is no owner in the query results (ie.
protected  CollectionPersister[] getCollectionPersisters()
          An (optional) persister for a collection to be initialized; only collection loaders return a non-null value
 String[] getCollectionSuffixes()
           
protected  boolean[] getEntityEagerPropertyFetches()
          An array indicating whether the entities have eager property fetching enabled
 Loadable[] getEntityPersisters()
          An array of persisters of entity classes contained in each row of results; implemented by all subclasses
protected  LockMode[] getLockModes(Map lockModes)
          What lock mode does this load entities with?
protected  EntityType[] getOwnerAssociationTypes()
          An array of unique key property names by which the corresponding entities are referenced by other entities in the result set
protected  int[] getOwners()
          An array of indexes of the entity that owns a one-to-one association to the entity at the given index (-1 if there is no "owner")
protected  String getQueryIdentifier()
          Identifies the query for statistics reporting, if null, no statistics will be reported
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)
           
 String[] getSqlAliasSuffixes()
           
protected  String getSQLString()
          The SQL query string to be called.
 String[] getSuffixes()
           
protected  boolean isSubselectLoadingEnabled()
           
 Iterator iterate(QueryParameters queryParameters, SessionImplementor session)
          Return the query results as an iterator
 List list(SessionImplementor session, QueryParameters queryParameters)
          Delegats
 ScrollableResults scroll(QueryParameters queryParameters, SessionImplementor session)
           
protected  boolean upgradeLocks()
          Does this query return objects that might be already cached by the session, whose lock mode may need upgrading
 
Methods inherited from class org.hibernate.loader.BasicLoader
generateSuffixes, generateSuffixes, getCollectionAliases, getEntityAliases, postInstantiate
 
Methods inherited from class org.hibernate.loader.Loader
bindPositionalParameters, doList, getFactory, getResultSet, getResultSet, hasSubselectLoadableCollections, isSingleRowLoader, list, loadCollection, loadCollectionBatch, loadCollectionSubselect, loadEntity, loadEntityBatch, loadSingleRow, prepareQueryStatement, preprocessSQL, scroll, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

QueryLoader

public QueryLoader(QueryTranslator queryTranslator,
                   SessionFactoryImplementor factory,
                   SelectClause selectClause)
Creates a new Loader implementation.

Parameters:
queryTranslator - The query translator that is the delegator.
factory - The factory from which this loader is being created.
Method Detail

getEntityPersisters

public Loadable[] getEntityPersisters()
Description copied from class: Loader
An array of persisters of entity classes contained in each row of results; implemented by all subclasses

Specified by:
getEntityPersisters in class Loader

getAliases

public String[] getAliases()
Description copied from class: Loader
Get the SQL table aliases of entities whose associations are subselect-loadable, returning null if this loader does not support subselect loading

Overrides:
getAliases in class Loader

getSqlAliasSuffixes

public String[] getSqlAliasSuffixes()

getSuffixes

public String[] getSuffixes()
Specified by:
getSuffixes in class BasicLoader

getCollectionSuffixes

public String[] getCollectionSuffixes()
Specified by:
getCollectionSuffixes in class BasicLoader

getQueryIdentifier

protected String getQueryIdentifier()
Description copied from class: Loader
Identifies the query for statistics reporting, if null, no statistics will be reported

Overrides:
getQueryIdentifier in class Loader

getSQLString

protected String getSQLString()
The SQL query string to be called.

Specified by:
getSQLString in class Loader

getCollectionPersisters

protected CollectionPersister[] getCollectionPersisters()
An (optional) persister for a collection to be initialized; only collection loaders return a non-null value

Overrides:
getCollectionPersisters in class Loader

getCollectionOwners

protected int[] getCollectionOwners()
Description copied from class: Loader
Get the index of the entity that owns the collection, or -1 if there is no owner in the query results (ie. in the case of a collection initializer) or no collection.

Overrides:
getCollectionOwners in class Loader

getEntityEagerPropertyFetches

protected boolean[] getEntityEagerPropertyFetches()
Description copied from class: Loader
An array indicating whether the entities have eager property fetching enabled

Overrides:
getEntityEagerPropertyFetches in class Loader

getOwners

protected int[] getOwners()
An array of indexes of the entity that owns a one-to-one association to the entity at the given index (-1 if there is no "owner")

Overrides:
getOwners in class Loader

getOwnerAssociationTypes

protected EntityType[] getOwnerAssociationTypes()
Description copied from class: Loader
An array of unique key property names by which the corresponding entities are referenced by other entities in the result set

Overrides:
getOwnerAssociationTypes in class Loader

isSubselectLoadingEnabled

protected boolean isSubselectLoadingEnabled()
Overrides:
isSubselectLoadingEnabled in class Loader

bindNamedParameters

protected int bindNamedParameters(PreparedStatement ps,
                                  Map namedParams,
                                  int start,
                                  SessionImplementor session)
                           throws SQLException,
                                  HibernateException
Description copied from class: Loader
Bind named parameters to the PreparedStatement. This has an empty implementation on this superclass and should be implemented by subclasses (queries) which allow named parameters.

Overrides:
bindNamedParameters in class Loader
Throws:
SQLException
HibernateException

getLockModes

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

Specified by:
getLockModes in class Loader
Parameters:
lockModes - a collection of lock modes specified dynamically via the Query interface

applyLocks

protected String applyLocks(String sql,
                            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

upgradeLocks

protected boolean upgradeLocks()
Description copied from class: Loader
Does this query return objects that might be already cached by the session, whose lock mode may need upgrading

Overrides:
upgradeLocks in class Loader

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

getResultList

protected List getResultList(List results)
                      throws QueryException
Overrides:
getResultList in class Loader
Throws:
QueryException

list

public List list(SessionImplementor session,
                 QueryParameters queryParameters)
          throws HibernateException
Delegats

Parameters:
session -
queryParameters -
Returns:
Throws:
HibernateException

iterate

public Iterator iterate(QueryParameters queryParameters,
                        SessionImplementor session)
                 throws HibernateException
Return the query results as an iterator

Throws:
HibernateException

scroll

public ScrollableResults scroll(QueryParameters queryParameters,
                                SessionImplementor session)
                         throws HibernateException
Throws:
HibernateException