类 AbstractLoadPlanBasedLoader
- java.lang.Object
-
- org.hibernate.loader.plan.exec.internal.AbstractLoadPlanBasedLoader
-
public abstract class AbstractLoadPlanBasedLoader extends Object
A superclass for loader implementations based on using LoadPlans.- 作者:
- Gail Badner
- 另请参阅:
EntityLoader,CollectionLoader
-
-
嵌套类概要
嵌套类 修饰符和类型 类 说明 protected static classAbstractLoadPlanBasedLoader.SqlStatementWrapper
-
构造器概要
构造器 构造器 说明 AbstractLoadPlanBasedLoader(SessionFactoryImplementor factory)Constructs aAbstractLoadPlanBasedLoader.
-
方法概要
所有方法 实例方法 抽象方法 具体方法 修饰符和类型 方法 说明 protected voidadvance(ResultSet rs, RowSelection selection)Advance the cursor to the first required row of the ResultSetprotected abstract voidautoDiscoverTypes(ResultSet rs)protected intbindNamedParameters(PreparedStatement statement, Map namedParams, int startIndex, SharedSessionContractImplementor session)Bind named parameters to the JDBC prepared statement.protected intbindParameterValues(PreparedStatement statement, QueryParameters queryParameters, int startIndex, SharedSessionContractImplementor session)Bind all parameter values into the prepared statement in preparation for execution.protected intbindPositionalParameters(PreparedStatement statement, QueryParameters queryParameters, int startIndex, SharedSessionContractImplementor session)Bind positional parameter values to the JDBC prepared statement.protected ListexecuteLoad(SharedSessionContractImplementor session, QueryParameters queryParameters, LoadQueryDetails loadQueryDetails, boolean returnProxies, ResultTransformer forcedResultTransformer)protected AbstractLoadPlanBasedLoader.SqlStatementWrapperexecuteQueryStatement(String sqlStatement, QueryParameters queryParameters, boolean scroll, SharedSessionContractImplementor session)protected SessionFactoryImplementorgetFactory()protected LimitHandlergetLimitHandler(RowSelection selection)Build LIMIT clause handler applicable for given selection criteria.protected abstract int[]getNamedParameterLocs(String name)protected ResultSetgetResultSet(PreparedStatement st, RowSelection selection, LimitHandler limitHandler, boolean autodiscovertypes, SharedSessionContractImplementor session)Execute given PreparedStatement, advance to the first result and return SQL ResultSet.protected ScrollModegetScrollMode(boolean scroll, boolean hasFirstRow, boolean useLimitOffSet, QueryParameters queryParameters)protected abstract LoadQueryDetailsgetStaticLoadQuery()protected PreparedStatementprepareQueryStatement(String sql, QueryParameters queryParameters, LimitHandler limitHandler, boolean scroll, SharedSessionContractImplementor session)Obtain a PreparedStatement with all parameters pre-bound.
-
-
-
构造器详细资料
-
AbstractLoadPlanBasedLoader
public AbstractLoadPlanBasedLoader(SessionFactoryImplementor factory)
Constructs aAbstractLoadPlanBasedLoader.- 参数:
factory- The session factory- 另请参阅:
SessionFactoryImplementor
-
-
方法详细资料
-
getFactory
protected SessionFactoryImplementor getFactory()
-
getStaticLoadQuery
protected abstract LoadQueryDetails getStaticLoadQuery()
-
getNamedParameterLocs
protected abstract int[] getNamedParameterLocs(String name)
-
autoDiscoverTypes
protected abstract void autoDiscoverTypes(ResultSet rs)
-
executeLoad
protected List executeLoad(SharedSessionContractImplementor session, QueryParameters queryParameters, LoadQueryDetails loadQueryDetails, boolean returnProxies, ResultTransformer forcedResultTransformer) throws SQLException
- 抛出:
SQLException
-
executeQueryStatement
protected AbstractLoadPlanBasedLoader.SqlStatementWrapper executeQueryStatement(String sqlStatement, QueryParameters queryParameters, boolean scroll, SharedSessionContractImplementor session) throws SQLException
- 抛出:
SQLException
-
getLimitHandler
protected LimitHandler getLimitHandler(RowSelection selection)
Build LIMIT clause handler applicable for given selection criteria. ReturnsNoopLimitHandlerdelegate if dialect does not support LIMIT expression or processed query does not use pagination.- 参数:
selection- Selection criteria.- 返回:
- LIMIT clause delegate.
-
prepareQueryStatement
protected final PreparedStatement prepareQueryStatement(String sql, QueryParameters queryParameters, LimitHandler limitHandler, boolean scroll, SharedSessionContractImplementor session) throws SQLException, HibernateException
Obtain a PreparedStatement with all parameters pre-bound. Bind JDBC-style ? parameters, named parameters, and limit parameters.
-
getScrollMode
protected ScrollMode getScrollMode(boolean scroll, boolean hasFirstRow, boolean useLimitOffSet, QueryParameters queryParameters)
-
bindParameterValues
protected int bindParameterValues(PreparedStatement statement, QueryParameters queryParameters, int startIndex, SharedSessionContractImplementor session) throws SQLException
Bind all parameter values into the prepared statement in preparation for execution.- 参数:
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.
-
bindPositionalParameters
protected int bindPositionalParameters(PreparedStatement statement, QueryParameters queryParameters, int startIndex, SharedSessionContractImplementor session) throws SQLException, HibernateException
Bind positional parameter values to the JDBC prepared statement. Positional parameters are those specified by JDBC-style ? parameters in the source query. It is (currently) expected that these come before any named parameters in the source query.- 参数:
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.HibernateException- Indicates problems delegating binding to the types.
-
bindNamedParameters
protected int bindNamedParameters(PreparedStatement statement, Map namedParams, int startIndex, SharedSessionContractImplementor session) throws SQLException, HibernateException
Bind named parameters to the JDBC prepared statement. This is a generic implementation, the problem being that in the general case we do not know enough information about the named parameters to perform this in a complete manner here. Thus this is generally overridden on subclasses allowing named parameters to apply the specific behavior. The most usual limitation here is that we need to assume the type span is always one...- 参数:
statement- The JDBC prepared statementnamedParams- A map of parameter names to valuesstartIndex- 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.HibernateException- Indicates problems delegating binding to the types.
-
getResultSet
protected final ResultSet getResultSet(PreparedStatement st, RowSelection selection, LimitHandler limitHandler, boolean autodiscovertypes, SharedSessionContractImplementor session) throws SQLException, HibernateException
Execute given PreparedStatement, advance to the first result and return SQL ResultSet.
-
advance
protected void advance(ResultSet rs, RowSelection selection) throws SQLException
Advance the cursor to the first required row of the ResultSet- 抛出:
SQLException
-
-