public class QueryLoader extends BasicLoader
A delegate that implements the Loader part of QueryTranslator.
Loader.SqlStatementWrapperNO_SUFFIXDEBUG_ENABLED, LOG, SELECT, SELECT_DISTINCT| Constructor and Description |
|---|
QueryLoader(org.hibernate.hql.internal.ast.QueryTranslatorImpl queryTranslator,
SessionFactoryImplementor factory,
org.hibernate.hql.internal.ast.tree.SelectClause selectClause)
Creates a new Loader implementation.
|
| Modifier and Type | Method and Description |
|---|---|
protected String |
applyLocks(String sql,
QueryParameters parameters,
Dialect dialect,
List<AfterLoadAction> afterLoadActions)
Append <tt>FOR UPDATE OF</tt> clause, if necessary.
|
protected void |
applyPostLoadLocks(Object[] row,
LockMode[] lockModesArray,
SharedSessionContractImplementor session) |
protected int |
bindParameterValues(PreparedStatement statement,
QueryParameters queryParameters,
int startIndex,
SharedSessionContractImplementor 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 explicitly here through the ParameterSpecification
interface.
|
org.hibernate.hql.internal.ast.tree.AggregatedSelectExpression |
getAggregatedSelectExpression() |
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(LockOptions lockOptions)
What lock options does this load entities with?
|
int[] |
getNamedParameterLocs(String name)
Returns the locations of all occurrences of the named parameter.
|
protected EntityType[] |
getOwnerAssociationTypes()
An array of the owner types corresponding to the
Loader.getOwners()
returns. |
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,
ResultTransformer transformer,
ResultSet rs,
SharedSessionContractImplementor session)
Get the actual object that is returned in the user-visible result list.
|
protected List |
getResultList(List results,
ResultTransformer resultTransformer) |
protected Object[] |
getResultRow(Object[] row,
ResultSet rs,
SharedSessionContractImplementor session) |
protected String[] |
getResultRowAliases()
Returns the aliases that corresponding to a result row.
|
String[] |
getSqlAliasSuffixes() |
String |
getSQLString()
The SQL query string to be called.
|
String[] |
getSuffixes() |
protected boolean[] |
includeInResultRow() |
protected boolean |
isSubselectLoadingEnabled() |
Iterator |
iterate(QueryParameters queryParameters,
EventSource session) |
List |
list(SharedSessionContractImplementor session,
QueryParameters queryParameters) |
protected boolean |
needsFetchingScroll()
Does the result set to be scrolled contain collection fetches?
|
protected ResultTransformer |
resolveResultTransformer(ResultTransformer resultTransformer)
Determine the actual ResultTransformer that will be used to
transform query results.
|
ScrollableResultsImplementor |
scroll(QueryParameters queryParameters,
SharedSessionContractImplementor session) |
protected boolean |
upgradeLocks()
Does this query return objects that might be already cached
by the session, whose lock mode may need upgrading
|
void |
validateScrollability() |
generateSuffixes, generateSuffixes, getCollectionAliases, getEntityAliases, postInstantiateareResultSetRowsTransformedImmediately, autoDiscoverTypes, bindNamedParameters, bindPositionalParameters, checkScrollability, determineFollowOnLockMode, doList, doQueryAndInitializeNonLazyCollections, doQueryAndInitializeNonLazyCollections, executeQueryStatement, executeQueryStatement, extractKeysFromResultSet, getCompositeKeyManyToOneTargetIndices, getFactory, getLimitHandler, getResultSet, getResultSet, hasSubselectLoadableCollections, isSingleRowLoader, list, loadCollection, loadCollectionBatch, loadCollectionSubselect, loadEntity, loadEntity, loadEntityBatch, loadSequentialRowsForward, loadSequentialRowsReverse, loadSingleRow, prepareQueryStatement, preprocessSQL, processDistinctKeyword, processResultSet, putResultInQueryCache, scroll, shouldUseFollowOnLocking, toStringpublic QueryLoader(org.hibernate.hql.internal.ast.QueryTranslatorImpl queryTranslator,
SessionFactoryImplementor factory,
org.hibernate.hql.internal.ast.tree.SelectClause selectClause)
Creates a new Loader implementation.
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.public org.hibernate.hql.internal.ast.tree.AggregatedSelectExpression getAggregatedSelectExpression()
public final void validateScrollability()
throws HibernateException
HibernateExceptionprotected boolean needsFetchingScroll()
LoaderDoes the result set to be scrolled contain collection fetches?
needsFetchingScroll in class Loaderpublic Loadable[] getEntityPersisters()
LoaderAn array of persisters of entity classes contained in each row of results; implemented by all subclasses
getEntityPersisters in class Loaderpublic String[] getAliases()
LoaderGet the SQL table aliases of entities whose associations are subselect-loadable, returning null if this loader does not support subselect loading
getAliases in class Loaderpublic String[] getSqlAliasSuffixes()
public String[] getSuffixes()
getSuffixes in class BasicLoaderpublic String[] getCollectionSuffixes()
getCollectionSuffixes in class BasicLoaderprotected String getQueryIdentifier()
LoaderIdentifies the query for statistics reporting, if null, no statistics will be reported
getQueryIdentifier in class Loaderpublic String getSQLString()
The SQL query string to be called.
getSQLString in class LoaderResultSet.protected CollectionPersister[] getCollectionPersisters()
An (optional) persister for a collection to be initialized; only collection loaders return a non-null value
getCollectionPersisters in class Loaderprotected int[] getCollectionOwners()
LoaderGet 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.
getCollectionOwners in class Loaderprotected boolean[] getEntityEagerPropertyFetches()
LoaderAn array indicating whether the entities have eager property fetching enabled.
getEntityEagerPropertyFetches in class Loaderprotected 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 EntityType[] getOwnerAssociationTypes()
LoaderAn array of the owner types corresponding to the Loader.getOwners()
returns. Indices indicating no owner would be null here.
getOwnerAssociationTypes in class Loaderprotected boolean isSubselectLoadingEnabled()
isSubselectLoadingEnabled in class Loaderprotected LockMode[] getLockModes(LockOptions lockOptions)
LoaderWhat lock options does this load entities with?
getLockModes in class LoaderlockOptions - a collection of lock modes specified dynamically via the Query interfaceprotected String applyLocks(String sql, QueryParameters parameters, Dialect dialect, List<AfterLoadAction> afterLoadActions) throws QueryException
LoaderAppend <tt>FOR UPDATE OF</tt> clause, if necessary. This empty superclass implementation merely returns its first argument.
applyLocks in class LoaderQueryExceptionprotected void applyPostLoadLocks(Object[] row, LockMode[] lockModesArray, SharedSessionContractImplementor session)
applyPostLoadLocks in class Loaderprotected boolean upgradeLocks()
LoaderDoes this query return objects that might be already cached by the session, whose lock mode may need upgrading
upgradeLocks in class Loaderprotected String[] getResultRowAliases()
LoaderReturns the aliases that corresponding to a result row.
getResultRowAliases in class Loaderprotected ResultTransformer resolveResultTransformer(ResultTransformer resultTransformer)
LoaderDetermine the actual ResultTransformer that will be used to transform query results.
resolveResultTransformer in class LoaderresultTransformer - the specified result transformerprotected boolean[] includeInResultRow()
includeInResultRow in class Loaderprotected Object getResultColumnOrRow(Object[] row, ResultTransformer transformer, ResultSet rs, SharedSessionContractImplementor session) throws SQLException, HibernateException
LoaderGet 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.
getResultColumnOrRow in class LoaderSQLExceptionHibernateExceptionprotected Object[] getResultRow(Object[] row, ResultSet rs, SharedSessionContractImplementor session) throws SQLException, HibernateException
getResultRow in class LoaderSQLExceptionHibernateExceptionprotected List getResultList(List results, ResultTransformer resultTransformer) throws QueryException
getResultList in class LoaderQueryExceptionpublic List list(SharedSessionContractImplementor session, QueryParameters queryParameters) throws HibernateException
HibernateExceptionpublic Iterator iterate(QueryParameters queryParameters, EventSource session) throws HibernateException
HibernateExceptionpublic ScrollableResultsImplementor scroll(QueryParameters queryParameters, SharedSessionContractImplementor session) throws HibernateException
HibernateExceptionpublic int[] getNamedParameterLocs(String name) throws QueryException
Returns the locations of all occurrences of the named parameter.
getNamedParameterLocs in class LoaderQueryExceptionprotected int bindParameterValues(PreparedStatement statement, QueryParameters queryParameters, int startIndex, SharedSessionContractImplementor 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 explicitly here through the ParameterSpecification interface.
bindParameterValues in class LoaderqueryParameters - The encapsulation of the parameter values to be bound.startIndex - The position from which to start binding parameter values.session - The originating session.statement - The JDBC prepared statementSQLException - Indicates problems performing the binding.Copyright © 2001-2018 Red Hat, Inc. All Rights Reserved.