Top Description Inners Fields Constructors Methods
org.hibernate.loader.plan.exec.internal

public abstract Class AbstractLoadPlanBasedLoader

extends Object
Class Inheritance
Known Direct Subclasses
org.hibernate.loader.collection.plan.AbstractLoadPlanBasedCollectionInitializer, org.hibernate.loader.entity.plan.AbstractLoadPlanBasedEntityLoader
Imports
java.sql.CallableStatement, .PreparedStatement, .ResultSet, .SQLException, .Statement, java.util.Collections, .Iterator, .List, .Map, org.hibernate.HibernateException, .LockOptions, .ScrollMode, org.hibernate.dialect.Dialect, org.hibernate.dialect.pagination.LimitHandler, .LimitHelper, .NoopLimitHandler, org.hibernate.engine.jdbc.ColumnNameCache, org.hibernate.engine.jdbc.spi.JdbcCoordinator, .JdbcServices, .ResultSetWrapper, org.hibernate.engine.spi.PersistenceContext, .QueryParameters, .RowSelection, .SessionFactoryImplementor, .SharedSessionContractImplementor, .TypedValue, org.hibernate.internal.CoreLogging, .CoreMessageLogger, org.hibernate.loader.plan.exec.query.spi.NamedParameterContext, org.hibernate.loader.plan.exec.spi.LoadQueryDetails, org.hibernate.resource.jdbc.ResourceRegistry, org.hibernate.transform.ResultTransformer, org.hibernate.type.Type

A superclass for loader implementations based on using LoadPlans.
Author
Gail Badner
See Also
org.hibernate.loader.entity.plan.EntityLoader, org.hibernate.loader.collection.plan.CollectionLoader

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected static class

Field Summary

Modifier and TypeField and Description
private ColumnNameCache
columnNameCache

Deprecated as a consequence of ColumnNameCache being deprecated.
private final SessionFactoryImplementor
factory

Deprecated as a consequence of SessionFactoryImplementor being deprecated.
private static final CoreMessageLogger

Constructor Summary

AccessConstructor and Description
public
AbstractLoadPlanBasedLoader(SessionFactoryImplementor
The session factory
factory
)

Deprecated as a consequence of SessionFactoryImplementor being deprecated.
Constructs a AbstractLoadPlanBasedLoader.

Method Summary

Modifier and TypeMethod and Description
protected void
advance(final ResultSet rs, final RowSelection selection)

Advance the cursor to the first required row of the ResultSet

protected abstract void
protected int

Returns:

The number of JDBC bind positions actually bound during this method execution.
bindNamedParameters
(final PreparedStatement
The JDBC prepared statement
statement
,
final Map<K, V>
A map of parameter names to values
namedParams
,
final int
The position from which to start binding parameter values.
startIndex
,
final SharedSessionContractImplementor
The originating session.
session
)

Bind named parameters to the JDBC prepared statement.

protected int

Returns:

The number of JDBC bind positions actually bound during this method execution.
bindParameterValues
(PreparedStatement
The JDBC prepared statement
statement
,
QueryParameters
The encapsulation of the parameter values to be bound.
queryParameters
,
int
The position from which to start binding parameter values.
startIndex
,
SharedSessionContractImplementor
The originating session.
session
)

Bind all parameter values into the prepared statement in preparation for execution.

protected int

Returns:

The number of JDBC bind positions actually bound during this method execution.
bindPositionalParameters
(final PreparedStatement
The JDBC prepared statement
statement
,
final QueryParameters
The encapsulation of the parameter values to be bound.
queryParameters
,
final int
The position from which to start binding parameter values.
startIndex
,
final SharedSessionContractImplementor
The originating session.
session
)

Bind positional parameter values to the JDBC prepared statement.

protected List<E>
executeLoad(SharedSessionContractImplementor session, QueryParameters queryParameters, LoadQueryDetails loadQueryDetails, boolean returnProxies, ResultTransformer forcedResultTransformer)

protected AbstractLoadPlanBasedLoader.SqlStatementWrapper
executeQueryStatement(String sqlStatement, QueryParameters queryParameters, boolean scroll, SharedSessionContractImplementor session)

protected SessionFactoryImplementor
getFactory()

Deprecated as a consequence of SessionFactoryImplementor being deprecated.
protected LimitHandler

Returns:

LIMIT clause delegate.
getLimitHandler
(RowSelection
Selection criteria.
selection
)

Build LIMIT clause handler applicable for given selection criteria.

protected abstract int[]
protected final ResultSet
getResultSet(final PreparedStatement st, final RowSelection selection, final LimitHandler limitHandler, final boolean autodiscovertypes, final SharedSessionContractImplementor session)

Execute given PreparedStatement, advance to the first result and return SQL ResultSet.

protected ScrollMode
getScrollMode(boolean scroll, boolean hasFirstRow, boolean useLimitOffSet, QueryParameters queryParameters)

protected abstract LoadQueryDetails
protected final PreparedStatement
prepareQueryStatement(final String sql, final QueryParameters queryParameters, final LimitHandler limitHandler, final boolean scroll, final SharedSessionContractImplementor session)

Obtain a PreparedStatement with all parameters pre-bound.

private ColumnNameCache
retreiveColumnNameToIndexCache(ResultSet rs)

Deprecated as a consequence of ColumnNameCache being deprecated.
private ResultSet
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

columnNameCacheback to summary
private ColumnNameCache columnNameCache

Deprecated

as a consequence of ColumnNameCache being deprecated. See corresponding docs for further information.

factoryback to summary
private final SessionFactoryImplementor factory

Deprecated

as a consequence of SessionFactoryImplementor being deprecated. See corresponding docs for further information.

logback to summary
private static final CoreMessageLogger log

Constructor Detail

AbstractLoadPlanBasedLoaderback to summary
public AbstractLoadPlanBasedLoader(SessionFactoryImplementor factory)

Deprecated

as a consequence of SessionFactoryImplementor being deprecated. See corresponding docs for further information.

Constructs a AbstractLoadPlanBasedLoader.

Parameters
factory:SessionFactoryImplementor

The session factory

See Also
SessionFactoryImplementor

Method Detail

advanceback to summary
protected void advance(final ResultSet rs, final RowSelection selection) throws SQLException

Advance the cursor to the first required row of the ResultSet

autoDiscoverTypesback to summary
protected abstract void autoDiscoverTypes(ResultSet rs)
bindNamedParametersback to summary
protected int bindNamedParameters(final PreparedStatement statement, final Map<K, V> namedParams, final int startIndex, final 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...

Parameters
statement:PreparedStatement

The JDBC prepared statement

namedParams:Map<K, V>

A map of parameter names to values

startIndex:int

The position from which to start binding parameter values.

session:SharedSessionContractImplementor

The originating session.

Returns:int

The number of JDBC bind positions actually bound during this method execution.

Exceptions
SQLException:
Indicates problems performing the binding.
HibernateException:
Indicates problems delegating binding to the types.
bindParameterValuesback to summary
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.

Parameters
statement:PreparedStatement

The JDBC prepared statement

queryParameters:QueryParameters

The encapsulation of the parameter values to be bound.

startIndex:int

The position from which to start binding parameter values.

session:SharedSessionContractImplementor

The originating session.

Returns:int

The number of JDBC bind positions actually bound during this method execution.

Exceptions
SQLException:
Indicates problems performing the binding.
bindPositionalParametersback to summary
protected int bindPositionalParameters(final PreparedStatement statement, final QueryParameters queryParameters, final int startIndex, final 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.

Parameters
statement:PreparedStatement

The JDBC prepared statement

queryParameters:QueryParameters

The encapsulation of the parameter values to be bound.

startIndex:int

The position from which to start binding parameter values.

session:SharedSessionContractImplementor

The originating session.

Returns:int

The number of JDBC bind positions actually bound during this method execution.

Exceptions
SQLException:
Indicates problems performing the binding.
HibernateException:
Indicates problems delegating binding to the types.
executeLoadback to summary
protected List<E> executeLoad(SharedSessionContractImplementor session, QueryParameters queryParameters, LoadQueryDetails loadQueryDetails, boolean returnProxies, ResultTransformer forcedResultTransformer) throws SQLException
executeQueryStatementback to summary
protected AbstractLoadPlanBasedLoader.SqlStatementWrapper executeQueryStatement(String sqlStatement, QueryParameters queryParameters, boolean scroll, SharedSessionContractImplementor session) throws SQLException
getFactoryback to summary
protected SessionFactoryImplementor getFactory()

Deprecated

as a consequence of SessionFactoryImplementor being deprecated. See corresponding docs for further information.

getLimitHandlerback to summary
protected LimitHandler getLimitHandler(RowSelection selection)

Build LIMIT clause handler applicable for given selection criteria. Returns org.hibernate.dialect.pagination.NoopLimitHandler delegate if dialect does not support LIMIT expression or processed query does not use pagination.

Parameters
selection:RowSelection

Selection criteria.

Returns:LimitHandler

LIMIT clause delegate.

getNamedParameterLocsback to summary
protected abstract int[] getNamedParameterLocs(String name)
getResultSetback to summary
protected final ResultSet getResultSet(final PreparedStatement st, final RowSelection selection, final LimitHandler limitHandler, final boolean autodiscovertypes, final SharedSessionContractImplementor session) throws SQLException, HibernateException

Execute given PreparedStatement, advance to the first result and return SQL ResultSet.

getScrollModeback to summary
protected ScrollMode getScrollMode(boolean scroll, boolean hasFirstRow, boolean useLimitOffSet, QueryParameters queryParameters)
getStaticLoadQueryback to summary
protected abstract LoadQueryDetails getStaticLoadQuery()
prepareQueryStatementback to summary
protected final PreparedStatement prepareQueryStatement(final String sql, final QueryParameters queryParameters, final LimitHandler limitHandler, final boolean scroll, final SharedSessionContractImplementor session) throws SQLException, HibernateException

Obtain a PreparedStatement with all parameters pre-bound. Bind JDBC-style ? parameters, named parameters, and limit parameters.

retreiveColumnNameToIndexCacheback to summary
private ColumnNameCache retreiveColumnNameToIndexCache(ResultSet rs) throws SQLException

Deprecated

as a consequence of ColumnNameCache being deprecated. See corresponding docs for further information.

wrapResultSetIfEnabledback to summary
private ResultSet wrapResultSetIfEnabled(final ResultSet rs, final SharedSessionContractImplementor session)
org.hibernate.loader.plan.exec.internal back to summary

protected Class AbstractLoadPlanBasedLoader.SqlStatementWrapper

extends Object
Class Inheritance
  • java.lang.Object
  • org.hibernate.loader.plan.exec.internal.AbstractLoadPlanBasedLoader.SqlStatementWrapper

Wrapper class for java.sql.Statement and associated java.sql.ResultSet.

Field Summary

Modifier and TypeField and Description
private final ResultSet
private final Statement

Constructor Summary

AccessConstructor and Description
private
SqlStatementWrapper(Statement statement, ResultSet resultSet)

Method Summary

Modifier and TypeMethod and Description
public ResultSet
public Statement
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

resultSetback to summary
private final ResultSet resultSet
statementback to summary
private final Statement statement

Constructor Detail

SqlStatementWrapperback to summary
private SqlStatementWrapper(Statement statement, ResultSet resultSet)

Method Detail

getResultSetback to summary
public ResultSet getResultSet()
getStatementback to summary
public Statement getStatement()