Top Description Fields Constructors Methods
org.hibernate.engine.query.spi

public Class HQLQueryPlan

extends Object
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Known Direct Subclasses
org.hibernate.engine.query.spi.FilterQueryPlan
Imports
java.io.Serializable, java.util.ArrayList, .Collections, .HashMap, .HashSet, .Iterator, .List, .Map, .Set, org.hibernate.Filter, .HibernateException, .QueryException, org.hibernate.engine.spi.QueryParameters, .RowSelection, .SessionFactoryImplementor, .SharedSessionContractImplementor, org.hibernate.event.spi.EventSource, org.hibernate.hql.internal.QuerySplitter, org.hibernate.hql.spi.FilterTranslator, .NamedParameterInformation, .ParameterTranslations, .PositionalParameterInformation, .QueryTranslator, .QueryTranslatorFactory, org.hibernate.internal.CoreLogging, .CoreMessageLogger, org.hibernate.internal.util.collections.ArrayHelper, .IdentitySet, .JoinedIterator, org.hibernate.query.internal.ParameterMetadataImpl, org.hibernate.query.spi.ScrollableResultsImplementor, org.hibernate.type.Type

Defines a query execution plan for an HQL query (or filter).
Author
Steve Ebersole

Field Summary

Modifier and TypeField and Description
private final Set<String>
private static final CoreMessageLogger
private final ParameterMetadataImpl
private final Set<E>
private final ReturnMetadata
private final boolean
private final String
private final QueryTranslator[]

Constructor Summary

AccessConstructor and Description
public
HQLQueryPlan(String
The HQL query
hql
,
boolean
Whether the execution is to be shallow or not
shallow
,
Map<String, Filter>
The enabled filters (we only keep the names)
enabledFilters
,
SessionFactoryImplementor
The factory
factory
)

Deprecated as a consequence of SessionFactoryImplementor being deprecated.
Constructs a HQLQueryPlan
public
HQLQueryPlan(String hql, boolean shallow, Map<String, Filter> enabledFilters, SessionFactoryImplementor factory, EntityGraphQueryHint entityGraphQueryHint)

Deprecated as a consequence of SessionFactoryImplementor being deprecated.
protected
HQLQueryPlan(String hql, String collectionRole, boolean shallow, Map<String, Filter> enabledFilters, SessionFactoryImplementor factory, EntityGraphQueryHint entityGraphQueryHint)

Deprecated as a consequence of SessionFactoryImplementor being deprecated.

Method Summary

Modifier and TypeMethod and Description
private ParameterMetadataImpl
public Class<T>
public Set<E>
public ParameterMetadataImpl
public Set<E>
public ReturnMetadata
public String
public String[]
getSqlStrings()

This method should only be called for debugging purposes as it regenerates a new array every time.

public QueryTranslator[]

Returns:

The translators
getTranslators
()

Access to the underlying translators associated with this query

public Set<E>
protected int

Returns:

a reasonable size to use for allocation
guessResultSize
(RowSelection rowSelection)

If we're able to guess a likely size of the results we can optimize allocation of our data structures.

public boolean
public boolean
public boolean
public int

Returns:

The aggregated "affected row" count
performExecuteUpdate
(QueryParameters
The query parameters
queryParameters
,
SharedSessionContractImplementor
The session
session
)

Coordinates the efforts to perform an execution across all the included query translators.

public Iterator<E>

Returns:

The query result iterator
performIterate
(QueryParameters
The query parameters
queryParameters
,
EventSource
The session
session
)

Deprecated as a consequence of EventSource being deprecated.
Coordinates the efforts to perform an iterate across all the included query translators.
public List<E>

Returns:

The query result list
performList
(QueryParameters
The query parameters
queryParameters
,
SharedSessionContractImplementor
The session
session
)

Coordinates the efforts to perform a list across all the included query translators.

public ScrollableResultsImplementor

Returns:

The query result iterator
performScroll
(QueryParameters
The query parameters
queryParameters
,
SharedSessionContractImplementor
The session
session
)

Coordinates the efforts to perform a scroll across all the included query translators.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

enabledFilterNamesback to summary
private final Set<String> enabledFilterNames
LOGback to summary
private static final CoreMessageLogger LOG
parameterMetadataback to summary
private final ParameterMetadataImpl parameterMetadata
querySpacesback to summary
private final Set<E> querySpaces
returnMetadataback to summary
private final ReturnMetadata returnMetadata
shallowback to summary
private final boolean shallow
sourceQueryback to summary
private final String sourceQuery
translatorsback to summary
private final QueryTranslator[] translators

Constructor Detail

HQLQueryPlanback to summary
public HQLQueryPlan(String hql, boolean shallow, Map<String, Filter> enabledFilters, SessionFactoryImplementor factory)

Deprecated

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

Constructs a HQLQueryPlan

Parameters
hql:String

The HQL query

shallow:boolean

Whether the execution is to be shallow or not

enabledFilters:Map<String, Filter>

The enabled filters (we only keep the names)

factory:SessionFactoryImplementor

The factory

HQLQueryPlanback to summary
public HQLQueryPlan(String hql, boolean shallow, Map<String, Filter> enabledFilters, SessionFactoryImplementor factory, EntityGraphQueryHint entityGraphQueryHint)

Deprecated

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

HQLQueryPlanback to summary
protected HQLQueryPlan(String hql, String collectionRole, boolean shallow, Map<String, Filter> enabledFilters, SessionFactoryImplementor factory, EntityGraphQueryHint entityGraphQueryHint)

Deprecated

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

Annotations
@SuppressWarnings:unchecked

Method Detail

buildParameterMetadataback to summary
private ParameterMetadataImpl buildParameterMetadata(ParameterTranslations parameterTranslations, String hql)
getDynamicInstantiationResultTypeback to summary
public Class<T> getDynamicInstantiationResultType()
getEnabledFilterNamesback to summary
public Set<E> getEnabledFilterNames()
getParameterMetadataback to summary
public ParameterMetadataImpl getParameterMetadata()
getQuerySpacesback to summary
public Set<E> getQuerySpaces()
getReturnMetadataback to summary
public ReturnMetadata getReturnMetadata()
getSourceQueryback to summary
public String getSourceQuery()
getSqlStringsback to summary
public String[] getSqlStrings()

This method should only be called for debugging purposes as it regenerates a new array every time.

getTranslatorsback to summary
public QueryTranslator[] getTranslators()

Access to the underlying translators associated with this query

Returns:QueryTranslator[]

The translators

getUtilizedFilterNamesback to summary
public Set<E> getUtilizedFilterNames()
guessResultSizeback to summary
protected int guessResultSize(RowSelection rowSelection)

If we're able to guess a likely size of the results we can optimize allocation of our data structures. Essentially if we detect the user is not using pagination, we attempt to use the FetchSize as a reasonable hint. If fetch size is not being set either, it is reasonable to expect that we're going to have a single hit. In such a case it would be tempting to return a constant of value one, but that's dangerous as it doesn't scale up appropriately for example with an ArrayList if the guess is wrong.

Returns:int

a reasonable size to use for allocation

Annotations
@SuppressWarnings:UnnecessaryUnboxing
isSelectback to summary
public boolean isSelect()
isShallowback to summary
public boolean isShallow()
isUpdateback to summary
public boolean isUpdate()
performExecuteUpdateback to summary
public int performExecuteUpdate(QueryParameters queryParameters, SharedSessionContractImplementor session) throws HibernateException

Coordinates the efforts to perform an execution across all the included query translators.

Parameters
queryParameters:QueryParameters

The query parameters

session:SharedSessionContractImplementor

The session

Returns:int

The aggregated "affected row" count

Exceptions
HibernateException:
Indicates a problem performing the execution
performIterateback to summary
public Iterator<E> performIterate(QueryParameters queryParameters, EventSource session) throws HibernateException

Deprecated

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

Coordinates the efforts to perform an iterate across all the included query translators.

Parameters
queryParameters:QueryParameters

The query parameters

session:EventSource

The session

Returns:Iterator<E>

The query result iterator

Annotations
@SuppressWarnings:unchecked
Exceptions
HibernateException:
Indicates a problem performing the query
performListback to summary
public List<E> performList(QueryParameters queryParameters, SharedSessionContractImplementor session) throws HibernateException

Coordinates the efforts to perform a list across all the included query translators.

Parameters
queryParameters:QueryParameters

The query parameters

session:SharedSessionContractImplementor

The session

Returns:List<E>

The query result list

Annotations
@SuppressWarnings:unchecked
Exceptions
HibernateException:
Indicates a problem performing the query
performScrollback to summary
public ScrollableResultsImplementor performScroll(QueryParameters queryParameters, SharedSessionContractImplementor session) throws HibernateException

Coordinates the efforts to perform a scroll across all the included query translators.

Parameters
queryParameters:QueryParameters

The query parameters

session:SharedSessionContractImplementor

The session

Returns:ScrollableResultsImplementor

The query result iterator

Exceptions
HibernateException:
Indicates a problem performing the query