org.hibernate.loader.hql

Class QueryLoader


public class QueryLoader
extends BasicLoader

A delegate that implements the Loader part of QueryTranslator.
Author:
josh

Field Summary

Fields inherited from class org.hibernate.loader.BasicLoader

NO_SUFFIX

Constructor Summary

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

Method Summary

protected String
applyLocks(String sql, Map lockModes, Dialect dialect)
protected int
bindParameterValues(PreparedStatement statement, QueryParameters queryParameters, int startIndex, SessionImplementor session)
We specifically override this method here, because in general we know much more about the parameters and their appropriate bind positions here then we do in our super because we track them explciitly here through the ParameterSpecification interface.
String[]
getAliases()
protected int[]
getCollectionOwners()
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()
Loadable[]
getEntityPersisters()
protected LockMode[]
getLockModes(Map lockModes)
int[]
getNamedParameterLocs(String name)
Returns the locations of all occurrences of the named parameter.
protected EntityType[]
getOwnerAssociationTypes()
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()
protected Object
getResultColumnOrRow(Object[] row, ResultTransformer transformer, ResultSet rs, SessionImplementor session)
protected List
getResultList(List results, ResultTransformer resultTransformer)
protected String
getSQLString()
The SQL query string to be called.
String[]
getSqlAliasSuffixes()
String[]
getSuffixes()
protected boolean
isSubselectLoadingEnabled()
Iterator
iterate(QueryParameters queryParameters, EventSource session)
List
list(SessionImplementor session, QueryParameters queryParameters)
protected boolean
needsFetchingScroll()
ScrollableResults
scroll(QueryParameters queryParameters, SessionImplementor session)
protected boolean
upgradeLocks()
void
validateScrollability()

Methods inherited from class org.hibernate.loader.BasicLoader

generateSuffixes, generateSuffixes, getCollectionAliases, getCollectionSuffixes, getEntityAliases, getSuffixes, postInstantiate

Methods inherited from class org.hibernate.loader.Loader

applyLocks, autoDiscoverTypes, bindNamedParameters, bindParameterValues, bindPositionalParameters, checkScrollability, doList, getAliases, getCollectionAliases, getCollectionOwners, getCollectionPersisters, getEntityAliases, getEntityEagerPropertyFetches, getEntityPersisters, getFactory, getLockModes, getNamedParameterLocs, getOwnerAssociationTypes, getOwners, getQueryIdentifier, getResultColumnOrRow, getResultList, getResultSet, getSQLString, hasSubselectLoadableCollections, isSingleRowLoader, isSubselectLoadingEnabled, list, loadCollection, loadCollectionBatch, loadCollectionSubselect, loadEntity, loadEntity, loadEntityBatch, loadSequentialRowsForward, loadSequentialRowsReverse, loadSingleRow, needsFetchingScroll, postInstantiate, prepareQueryStatement, preprocessSQL, scroll, toString, upgradeLocks

Constructor Details

QueryLoader

public QueryLoader(QueryTranslatorImpl 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.
selectClause - The AST representing the select clause for loading.

Method Details

applyLocks

protected String applyLocks(String sql,
                            Map lockModes,
                            Dialect dialect)
            throws QueryException
Overrides:
applyLocks in interface Loader

bindParameterValues

protected int bindParameterValues(PreparedStatement statement,
                                  QueryParameters queryParameters,
                                  int startIndex,
                                  SessionImplementor session)
            throws SQLException
We specifically override this method here, because in general we know much more about the parameters and their appropriate bind positions here then we do in our super because we track them explciitly here through the ParameterSpecification interface.
Overrides:
bindParameterValues in interface Loader
Parameters:
queryParameters - The encapsulation of the parameter values to be bound.
startIndex - The position from which to start binding parameter values.
session - The originating session.
Returns:
The number of JDBC bind positions actually bound during this method execution.

getAliases

public String[] getAliases()
Overrides:
getAliases in interface Loader

getCollectionOwners

protected int[] getCollectionOwners()
Overrides:
getCollectionOwners in interface 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 interface Loader

getCollectionSuffixes

public String[] getCollectionSuffixes()
Overrides:
getCollectionSuffixes in interface BasicLoader

getEntityEagerPropertyFetches

protected boolean[] getEntityEagerPropertyFetches()
Overrides:
getEntityEagerPropertyFetches in interface Loader

getEntityPersisters

public Loadable[] getEntityPersisters()
Overrides:
getEntityPersisters in interface Loader

getLockModes

protected LockMode[] getLockModes(Map lockModes)
Overrides:
getLockModes in interface Loader
Parameters:
lockModes - a collection of lock modes specified dynamically via the Query interface

getNamedParameterLocs

public int[] getNamedParameterLocs(String name)
            throws QueryException
Returns the locations of all occurrences of the named parameter.
Overrides:
getNamedParameterLocs in interface Loader

getOwnerAssociationTypes

protected EntityType[] getOwnerAssociationTypes()
Overrides:
getOwnerAssociationTypes in interface 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 interface Loader

getQueryIdentifier

protected String getQueryIdentifier()
Overrides:
getQueryIdentifier in interface Loader

getResultColumnOrRow

protected Object getResultColumnOrRow(Object[] row,
                                      ResultTransformer transformer,
                                      ResultSet rs,
                                      SessionImplementor session)
            throws SQLException,
                   HibernateException
Overrides:
getResultColumnOrRow in interface Loader

getResultList

protected List getResultList(List results,
                             ResultTransformer resultTransformer)
            throws QueryException
Overrides:
getResultList in interface Loader

getSQLString

protected String getSQLString()
The SQL query string to be called.
Overrides:
getSQLString in interface Loader

getSqlAliasSuffixes

public String[] getSqlAliasSuffixes()

getSuffixes

public String[] getSuffixes()
Overrides:
getSuffixes in interface BasicLoader

isSubselectLoadingEnabled

protected boolean isSubselectLoadingEnabled()
Overrides:
isSubselectLoadingEnabled in interface Loader

iterate

public Iterator iterate(QueryParameters queryParameters,
                        EventSource session)
            throws HibernateException

list

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

needsFetchingScroll

protected boolean needsFetchingScroll()
Overrides:
needsFetchingScroll in interface Loader

scroll

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

upgradeLocks

protected boolean upgradeLocks()
Overrides:
upgradeLocks in interface Loader

validateScrollability

public final void validateScrollability()
            throws HibernateException