类 CustomLoader
- java.lang.Object
-
- org.hibernate.loader.Loader
-
- org.hibernate.loader.custom.CustomLoader
-
public class CustomLoader extends Loader
Extension point for loaders which use a SQL result set with "unexpected" column aliases.- 作者:
- Gavin King, Steve Ebersole
-
-
嵌套类概要
-
从类继承的嵌套类/接口 org.hibernate.loader.Loader
Loader.SqlStatementWrapper
-
-
字段概要
-
从类继承的字段 org.hibernate.loader.Loader
LOG, SELECT, SELECT_DISTINCT
-
-
构造器概要
构造器 构造器 说明 CustomLoader(CustomQuery customQuery, SessionFactoryImplementor factory)
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 protected StringapplyLocks(String sql, QueryParameters parameters, Dialect dialect, List<AfterLoadAction> afterLoadActions)Append FOR UPDATE OF clause, if necessary.protected voidautoDiscoverTypes(ResultSet rs)protected intbindParameterValues(PreparedStatement statement, QueryParameters queryParameters, int startIndex, SharedSessionContractImplementor session)Bind all parameter values into the prepared statement in preparation for execution.protected CollectionAliases[]getCollectionAliases()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. 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 valueprotected EntityAliases[]getEntityAliases()Get the result set descriptorprotected 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?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 reportedSetgetQuerySpaces()protected 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.StringgetSQLString()The SQL query string to be called; implemented by all subclassesprotected boolean[]includeInResultRow()Listlist(SharedSessionContractImplementor session, QueryParameters queryParameters)protected voidputResultInQueryCache(SharedSessionContractImplementor session, QueryParameters queryParameters, Type[] resultTypes, QueryResultsCache queryCache, QueryKey key, List result)resultTypescan be overridden byautoDiscoverTypes(ResultSet), *after*list(SharedSessionContractImplementor, QueryParameters)has already been called.protected ResultTransformerresolveResultTransformer(ResultTransformer resultTransformer)Determine the actual ResultTransformer that will be used to transform query results.ScrollableResultsImplementorscroll(QueryParameters queryParameters, SharedSessionContractImplementor session)protected voidvalidateAlias(String alias)-
从类继承的方法 org.hibernate.loader.Loader
applyPostLoadLocks, areResultSetRowsTransformedImmediately, bindNamedParameters, bindPositionalParameters, checkScrollability, determineFollowOnLockMode, doList, doQueryAndInitializeNonLazyCollections, doQueryAndInitializeNonLazyCollections, executeQueryStatement, executeQueryStatement, extractKeysFromResultSet, getAliases, getCompositeKeyManyToOneTargetIndices, getEntityEagerPropertyFetches, getFactory, getLimitHandler, getNamedParameterLocs, getOwnerAssociationTypes, getResultSet, getResultSet, hasSubselectLoadableCollections, isSingleRowLoader, isSubselectLoadingEnabled, list, loadCollection, loadCollectionBatch, loadCollectionSubselect, loadEntity, loadEntity, loadEntityBatch, loadEntityBatch, loadSequentialRowsForward, loadSequentialRowsReverse, loadSingleRow, needsFetchingScroll, postInstantiate, prepareQueryStatement, preprocessSQL, processDistinctKeyword, processResultSet, scroll, shouldUseFollowOnLocking, toString, upgradeLocks
-
-
-
-
构造器详细资料
-
CustomLoader
public CustomLoader(CustomQuery customQuery, SessionFactoryImplementor factory)
-
-
方法详细资料
-
getQueryIdentifier
protected String getQueryIdentifier()
从类复制的说明:LoaderIdentifies the query for statistics reporting, if null, no statistics will be reported- 覆盖:
getQueryIdentifier在类中Loader
-
getSQLString
public String getSQLString()
从类复制的说明:LoaderThe SQL query string to be called; implemented by all subclasses- 指定者:
getSQLString在类中Loader- 返回:
- The sql command this loader should use to get its
ResultSet.
-
getQuerySpaces
public Set getQuerySpaces()
-
getLockModes
protected LockMode[] getLockModes(LockOptions lockOptions)
从类复制的说明:LoaderWhat lock options does this load entities with?- 指定者:
getLockModes在类中Loader- 参数:
lockOptions- a collection of lock options specified dynamically via the Query interface
-
getEntityPersisters
protected Loadable[] getEntityPersisters()
从类复制的说明:LoaderAn array of persisters of entity classes contained in each row of results; implemented by all subclasses- 指定者:
getEntityPersisters在类中Loader- 返回:
- The entity persisters.
-
getCollectionPersisters
protected CollectionPersister[] getCollectionPersisters()
从类复制的说明:LoaderAn (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
-
getOwners
protected int[] getOwners()
从类复制的说明:LoaderAn 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"). The indexes contained here are relative to the result ofLoader.getEntityPersisters().
-
list
public List list(SharedSessionContractImplementor session, QueryParameters queryParameters) throws HibernateException
-
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
-
scroll
public ScrollableResultsImplementor scroll(QueryParameters queryParameters, SharedSessionContractImplementor session) throws HibernateException
-
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
-
getEntityAliases
protected EntityAliases[] getEntityAliases()
从类复制的说明:LoaderGet the result set descriptor- 指定者:
getEntityAliases在类中Loader
-
getCollectionAliases
protected CollectionAliases[] getCollectionAliases()
- 指定者:
getCollectionAliases在类中Loader
-
bindParameterValues
protected int bindParameterValues(PreparedStatement statement, QueryParameters queryParameters, int startIndex, SharedSessionContractImplementor session) throws SQLException
从类复制的说明:LoaderBind all parameter values into the prepared statement in preparation for execution.- 覆盖:
bindParameterValues在类中Loader- 参数:
statement- The JDBC prepared statementqueryParameters- The encapsulation of the parameter values to be bound.startIndex- The position from which to start binding parameter values.session- The originating session.- 返回:
- The number of JDBC bind positions actually bound during this method execution.
- 抛出:
SQLException- Indicates problems performing the binding.
-
autoDiscoverTypes
protected void autoDiscoverTypes(ResultSet rs)
- 覆盖:
autoDiscoverTypes在类中Loader
-
validateAlias
protected void validateAlias(String alias)
-
putResultInQueryCache
protected void putResultInQueryCache(SharedSessionContractImplementor session, QueryParameters queryParameters, Type[] resultTypes, QueryResultsCache queryCache, QueryKey key, List result)
resultTypescan be overridden byautoDiscoverTypes(ResultSet), *after*list(SharedSessionContractImplementor, QueryParameters)has already been called. It's a bit of a chicken-and-the-egg issue sinceautoDiscoverTypes(ResultSet)needs theResultSet. As a hacky workaround, overridden here to provide theresultTypes. see HHH-3051- 覆盖:
putResultInQueryCache在类中Loader
-
-