类 QueryLoader
- java.lang.Object
-
- org.hibernate.loader.Loader
-
- org.hibernate.loader.BasicLoader
-
- org.hibernate.loader.hql.QueryLoader
-
public class QueryLoader extends BasicLoader
A delegate that implements the Loader part of QueryTranslator.- 作者:
- josh
-
-
嵌套类概要
-
从类继承的嵌套类/接口 org.hibernate.loader.Loader
Loader.SqlStatementWrapper
-
-
字段概要
-
从类继承的字段 org.hibernate.loader.BasicLoader
NO_SUFFIX
-
从类继承的字段 org.hibernate.loader.Loader
LOG, SELECT, SELECT_DISTINCT
-
-
构造器概要
构造器 构造器 说明 QueryLoader(QueryTranslatorImpl queryTranslator, SessionFactoryImplementor factory, SelectClause selectClause)Creates a new Loader implementation.
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 protected StringapplyLocks(String sql, QueryParameters parameters, Dialect dialect, List<AfterLoadAction> afterLoadActions)Append FOR UPDATE OF clause, if necessary.protected voidapplyPostLoadLocks(Object[] row, LockMode[] lockModesArray, SharedSessionContractImplementor session)protected intbindParameterValues(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.AggregatedSelectExpressiongetAggregatedSelectExpression()String[]getAliases()Get the SQL table aliases of entities whose associations are subselect-loadable, returning null if this loader does not support subselect loadingprotected int[]getCollectionOwners()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.protected CollectionPersister[]getCollectionPersisters()An (optional) persister for a collection to be initialized; only collection loaders return a non-null valueString[]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 subclassesprotected 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 theLoader.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 StringgetQueryIdentifier()Identifies the query for statistics reporting, if null, no statistics will be reportedprotected ObjectgetResultColumnOrRow(Object[] row, ResultTransformer transformer, ResultSet rs, SharedSessionContractImplementor session)Get the actual object that is returned in the user-visible result list.protected ListgetResultList(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()StringgetSQLString()The SQL query string to be called.String[]getSuffixes()protected boolean[]includeInResultRow()protected booleanisSubselectLoadingEnabled()Iteratoriterate(QueryParameters queryParameters, EventSource session)Listlist(SharedSessionContractImplementor session, QueryParameters queryParameters)protected booleanneedsFetchingScroll()Does the result set to be scrolled contain collection fetches?protected ResultTransformerresolveResultTransformer(ResultTransformer resultTransformer)Determine the actual ResultTransformer that will be used to transform query results.ScrollableResultsImplementorscroll(QueryParameters queryParameters, SharedSessionContractImplementor session)protected booleanupgradeLocks()Does this query return objects that might be already cached by the session, whose lock mode may need upgradingvoidvalidateScrollability()-
从类继承的方法 org.hibernate.loader.BasicLoader
generateSuffixes, generateSuffixes, getCollectionAliases, getEntityAliases, postInstantiate
-
从类继承的方法 org.hibernate.loader.Loader
areResultSetRowsTransformedImmediately, 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, loadEntityBatch, loadSequentialRowsForward, loadSequentialRowsReverse, loadSingleRow, prepareQueryStatement, preprocessSQL, processDistinctKeyword, processResultSet, putResultInQueryCache, scroll, shouldUseFollowOnLocking, toString
-
-
-
-
构造器详细资料
-
QueryLoader
public QueryLoader(QueryTranslatorImpl queryTranslator, SessionFactoryImplementor factory, 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.
-
-
方法详细资料
-
getAggregatedSelectExpression
public AggregatedSelectExpression getAggregatedSelectExpression()
-
validateScrollability
public final void validateScrollability() throws HibernateException
-
needsFetchingScroll
protected boolean needsFetchingScroll()
从类复制的说明:LoaderDoes the result set to be scrolled contain collection fetches?- 覆盖:
needsFetchingScroll在类中Loader- 返回:
- True if it does, and thus needs the special fetching scroll functionality; false otherwise.
-
getEntityPersisters
public Loadable[] getEntityPersisters()
从类复制的说明:LoaderAn array of persisters of entity classes contained in each row of results; implemented by all subclasses- 指定者:
getEntityPersisters在类中Loader- 返回:
- The entity persisters.
-
getAliases
public 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在类中Loader
-
getSqlAliasSuffixes
public String[] getSqlAliasSuffixes()
-
getSuffixes
public String[] getSuffixes()
- 指定者:
getSuffixes在类中BasicLoader
-
getCollectionSuffixes
public String[] getCollectionSuffixes()
- 指定者:
getCollectionSuffixes在类中BasicLoader
-
getQueryIdentifier
protected String getQueryIdentifier()
从类复制的说明:LoaderIdentifies the query for statistics reporting, if null, no statistics will be reported- 覆盖:
getQueryIdentifier在类中Loader
-
getSQLString
public String getSQLString()
The SQL query string to be called.- 指定者:
getSQLString在类中Loader- 返回:
- The sql command this loader should use to get its
ResultSet.
-
getCollectionPersisters
protected CollectionPersister[] getCollectionPersisters()
An (optional) persister for a collection to be initialized; only collection loaders return a non-null value- 覆盖:
getCollectionPersisters在类中Loader
-
getCollectionOwners
protected 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在类中Loader
-
getEntityEagerPropertyFetches
protected boolean[] getEntityEagerPropertyFetches()
从类复制的说明:LoaderAn array indicating whether the entities have eager property fetching enabled.- 覆盖:
getEntityEagerPropertyFetches在类中Loader- 返回:
- Eager property fetching indicators.
-
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")
-
getOwnerAssociationTypes
protected EntityType[] getOwnerAssociationTypes()
从类复制的说明:LoaderAn array of the owner types corresponding to theLoader.getOwners()returns. Indices indicating no owner would be null here.- 覆盖:
getOwnerAssociationTypes在类中Loader- 返回:
- The types for the owners.
-
isSubselectLoadingEnabled
protected boolean isSubselectLoadingEnabled()
- 覆盖:
isSubselectLoadingEnabled在类中Loader
-
getLockModes
protected LockMode[] getLockModes(LockOptions lockOptions)
从类复制的说明:LoaderWhat lock options does this load entities with?- 指定者:
getLockModes在类中Loader- 参数:
lockOptions- a collection of lock modes specified dynamically via the Query interface
-
applyLocks
protected String applyLocks(String sql, QueryParameters parameters, Dialect dialect, List<AfterLoadAction> afterLoadActions) throws QueryException
从类复制的说明:LoaderAppend FOR UPDATE OF clause, if necessary. This empty superclass implementation merely returns its first argument.- 覆盖:
applyLocks在类中Loader- 抛出:
QueryException
-
applyPostLoadLocks
protected void applyPostLoadLocks(Object[] row, LockMode[] lockModesArray, SharedSessionContractImplementor session)
- 覆盖:
applyPostLoadLocks在类中Loader
-
upgradeLocks
protected boolean upgradeLocks()
从类复制的说明:LoaderDoes this query return objects that might be already cached by the session, whose lock mode may need upgrading- 覆盖:
upgradeLocks在类中Loader
-
getResultRowAliases
protected String[] getResultRowAliases()
从类复制的说明:LoaderReturns the aliases that corresponding to a result row.- 覆盖:
getResultRowAliases在类中Loader- 返回:
- Returns the aliases that corresponding to a result row.
-
resolveResultTransformer
protected ResultTransformer resolveResultTransformer(ResultTransformer resultTransformer)
从类复制的说明:LoaderDetermine the actual ResultTransformer that will be used to transform query results.- 覆盖:
resolveResultTransformer在类中Loader- 参数:
resultTransformer- the specified result transformer- 返回:
- the actual result transformer
-
includeInResultRow
protected boolean[] includeInResultRow()
- 覆盖:
includeInResultRow在类中Loader
-
getResultColumnOrRow
protected 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在类中Loader- 抛出:
SQLExceptionHibernateException
-
getResultRow
protected Object[] getResultRow(Object[] row, ResultSet rs, SharedSessionContractImplementor session) throws SQLException, HibernateException
- 覆盖:
getResultRow在类中Loader- 抛出:
SQLExceptionHibernateException
-
getResultList
protected List getResultList(List results, ResultTransformer resultTransformer) throws QueryException
- 覆盖:
getResultList在类中Loader- 抛出:
QueryException
-
list
public List list(SharedSessionContractImplementor session, QueryParameters queryParameters) throws HibernateException
-
iterate
public Iterator iterate(QueryParameters queryParameters, EventSource session) throws HibernateException
-
scroll
public ScrollableResultsImplementor scroll(QueryParameters queryParameters, SharedSessionContractImplementor session) throws HibernateException
-
getNamedParameterLocs
public int[] getNamedParameterLocs(String name) throws QueryException
Returns the locations of all occurrences of the named parameter.- 覆盖:
getNamedParameterLocs在类中Loader- 抛出:
QueryException
-
bindParameterValues
protected 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在类中Loader- 参数:
queryParameters- 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 statement- 返回:
- The number of JDBC bind positions actually bound during this method execution.
- 抛出:
SQLException- Indicates problems performing the binding.
-
-