Package org.hibernate.engine.query.spi
Class HQLQueryPlan
- java.lang.Object
-
- org.hibernate.engine.query.spi.HQLQueryPlan
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
FilterQueryPlan
public class HQLQueryPlan extends java.lang.Object implements java.io.SerializableDefines a query execution plan for an HQL query (or filter).- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description HQLQueryPlan(java.lang.String hql, boolean shallow, java.util.Map<java.lang.String,Filter> enabledFilters, SessionFactoryImplementor factory)Constructs a HQLQueryPlanHQLQueryPlan(java.lang.String hql, boolean shallow, java.util.Map<java.lang.String,Filter> enabledFilters, SessionFactoryImplementor factory, EntityGraphQueryHint entityGraphQueryHint)protectedHQLQueryPlan(java.lang.String hql, java.lang.String collectionRole, boolean shallow, java.util.Map<java.lang.String,Filter> enabledFilters, SessionFactoryImplementor factory, EntityGraphQueryHint entityGraphQueryHint)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.ClassgetDynamicInstantiationResultType()java.util.SetgetEnabledFilterNames()org.hibernate.query.internal.ParameterMetadataImplgetParameterMetadata()java.util.SetgetQuerySpaces()ReturnMetadatagetReturnMetadata()java.lang.StringgetSourceQuery()java.lang.String[]getSqlStrings()This method should only be called for debugging purposes as it regenerates a new array every time.QueryTranslator[]getTranslators()Access to the underlying translators associated with this queryjava.util.SetgetUtilizedFilterNames()protected intguessResultSize(RowSelection rowSelection)If we're able to guess a likely size of the results we can optimize allocation of our data structures.booleanisSelect()booleanisShallow()booleanisUpdate()intperformExecuteUpdate(QueryParameters queryParameters, SharedSessionContractImplementor session)Coordinates the efforts to perform an execution across all the included query translators.java.util.IteratorperformIterate(QueryParameters queryParameters, EventSource session)Coordinates the efforts to perform an iterate across all the included query translators.java.util.ListperformList(QueryParameters queryParameters, SharedSessionContractImplementor session)Coordinates the efforts to perform a list across all the included query translators.ScrollableResultsImplementorperformScroll(QueryParameters queryParameters, SharedSessionContractImplementor session)Coordinates the efforts to perform a scroll across all the included query translators.
-
-
-
Constructor Detail
-
HQLQueryPlan
public HQLQueryPlan(java.lang.String hql, boolean shallow, java.util.Map<java.lang.String,Filter> enabledFilters, SessionFactoryImplementor factory)Constructs a HQLQueryPlan- Parameters:
hql- The HQL queryshallow- Whether the execution is to be shallow or notenabledFilters- The enabled filters (we only keep the names)factory- The factory
-
HQLQueryPlan
public HQLQueryPlan(java.lang.String hql, boolean shallow, java.util.Map<java.lang.String,Filter> enabledFilters, SessionFactoryImplementor factory, EntityGraphQueryHint entityGraphQueryHint)
-
HQLQueryPlan
protected HQLQueryPlan(java.lang.String hql, java.lang.String collectionRole, boolean shallow, java.util.Map<java.lang.String,Filter> enabledFilters, SessionFactoryImplementor factory, EntityGraphQueryHint entityGraphQueryHint)
-
-
Method Detail
-
getSourceQuery
public java.lang.String getSourceQuery()
-
getQuerySpaces
public java.util.Set getQuerySpaces()
-
getParameterMetadata
public org.hibernate.query.internal.ParameterMetadataImpl getParameterMetadata()
-
getReturnMetadata
public ReturnMetadata getReturnMetadata()
-
getEnabledFilterNames
public java.util.Set getEnabledFilterNames()
-
getSqlStrings
public java.lang.String[] getSqlStrings()
This method should only be called for debugging purposes as it regenerates a new array every time.
-
getUtilizedFilterNames
public java.util.Set getUtilizedFilterNames()
-
isShallow
public boolean isShallow()
-
performList
public java.util.List performList(QueryParameters queryParameters, SharedSessionContractImplementor session) throws HibernateException
Coordinates the efforts to perform a list across all the included query translators.- Parameters:
queryParameters- The query parameterssession- The session- Returns:
- The query result list
- Throws:
HibernateException- Indicates a problem performing the query
-
guessResultSize
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.- Parameters:
rowSelection-- Returns:
- a reasonable size to use for allocation
-
performIterate
public java.util.Iterator performIterate(QueryParameters queryParameters, EventSource session) throws HibernateException
Coordinates the efforts to perform an iterate across all the included query translators.- Parameters:
queryParameters- The query parameterssession- The session- Returns:
- The query result iterator
- Throws:
HibernateException- Indicates a problem performing the query
-
performScroll
public ScrollableResultsImplementor performScroll(QueryParameters queryParameters, SharedSessionContractImplementor session) throws HibernateException
Coordinates the efforts to perform a scroll across all the included query translators.- Parameters:
queryParameters- The query parameterssession- The session- Returns:
- The query result iterator
- Throws:
HibernateException- Indicates a problem performing the query
-
performExecuteUpdate
public int performExecuteUpdate(QueryParameters queryParameters, SharedSessionContractImplementor session) throws HibernateException
Coordinates the efforts to perform an execution across all the included query translators.- Parameters:
queryParameters- The query parameterssession- The session- Returns:
- The aggregated "affected row" count
- Throws:
HibernateException- Indicates a problem performing the execution
-
getTranslators
public QueryTranslator[] getTranslators()
Access to the underlying translators associated with this query- Returns:
- The translators
-
getDynamicInstantiationResultType
public java.lang.Class getDynamicInstantiationResultType()
-
isSelect
public boolean isSelect()
-
isUpdate
public boolean isUpdate()
-
-