public class

QueryTranslatorImpl

extends Object
implements FilterTranslator
java.lang.Object
   ↳ org.hibernate.hql.ast.QueryTranslatorImpl

Class Overview

A QueryTranslator that uses an Antlr-based parser.

Summary

Nested Classes
class QueryTranslatorImpl.JavaConstantConverter  
[Expand]
Inherited Constants
From interface org.hibernate.hql.QueryTranslator
Public Constructors
QueryTranslatorImpl(String queryIdentifier, String query, Map enabledFilters, SessionFactoryImplementor factory)
Creates a new AST-based query translator.
Public Methods
List collectSqlStrings()
void compile(Map replacements, boolean shallow)
Compile a "normal" query.
void compile(String collectionRole, Map replacements, boolean shallow)
Compile a filter.
boolean containsCollectionFetches()
Does the translated query contain collection fetches?
int executeUpdate(QueryParameters queryParameters, SessionImplementor session)
Perform a bulk update/delete operation given the underlying query definition.
List getCollectedParameterSpecifications()
String[][] getColumnNames()
Returns the column names in the generated SQL.
Map getEnabledFilters()
Returns the filters enabled for this query translator.
int[] getNamedParameterLocs(String name)
ParameterTranslations getParameterTranslations()
Return information about any parameters encountered during translation.
String getQueryIdentifier()
Retrieve the query identifier for this translator.
Set getQuerySpaces()
Returns the set of query spaces (table names) that the query refers to.
String getQueryString()
Returns the HQL string processed by the translator.
String[] getReturnAliases()
Returns an array of HQL aliases
Type[] getReturnTypes()
Types of the return values of an iterate() style query.
String getSQLString()
The SQL query string to be called; implemented by all subclasses
Statement getSqlAST()
boolean isManipulationStatement()
boolean isShallowQuery()
Iterator iterate(QueryParameters queryParameters, EventSource session)
Return the query results as an iterator
List list(SessionImplementor session, QueryParameters queryParameters)
Perform a list operation given the underlying query definition.
ScrollableResults scroll(QueryParameters queryParameters, SessionImplementor session)
Return the query results, as an instance of ScrollableResults
void validateScrollability()
Validate the scrollability of the translated query.
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.hibernate.hql.FilterTranslator
From interface org.hibernate.hql.QueryTranslator

Public Constructors

public QueryTranslatorImpl (String queryIdentifier, String query, Map enabledFilters, SessionFactoryImplementor factory)

Creates a new AST-based query translator.

Parameters
queryIdentifier The query-identifier (used in stats collection)
query The hql query to translate
enabledFilters Currently enabled filters
factory The session factory constructing this translator instance.

Public Methods

public List collectSqlStrings ()

public void compile (Map replacements, boolean shallow)

Compile a "normal" query. This method may be called multiple times. Subsequent invocations are no-ops.

Parameters
replacements Defined query substitutions.
shallow Does this represent a shallow (scalar or entity-id) select?
Throws
QueryException There was a problem parsing the query string.
MappingException There was a problem querying defined mappings.

public void compile (String collectionRole, Map replacements, boolean shallow)

Compile a filter. This method may be called multiple times. Subsequent invocations are no-ops.

Parameters
collectionRole the role name of the collection used as the basis for the filter.
replacements Defined query substitutions.
shallow Does this represent a shallow (scalar or entity-id) select?
Throws
QueryException There was a problem parsing the query string.
MappingException There was a problem querying defined mappings.

public boolean containsCollectionFetches ()

Does the translated query contain collection fetches?

Returns
  • true if the query does contain collection fetched; false otherwise.

public int executeUpdate (QueryParameters queryParameters, SessionImplementor session)

Perform a bulk update/delete operation given the underlying query definition.

Parameters
queryParameters The query bind parameters.
session The session owning this query.
Returns
  • The number of entities updated or deleted.

public List getCollectedParameterSpecifications ()

public String[][] getColumnNames ()

Returns the column names in the generated SQL.

Returns
  • the column names in the generated SQL.

public Map getEnabledFilters ()

Returns the filters enabled for this query translator.

Returns
  • Filters enabled for this query execution.

public int[] getNamedParameterLocs (String name)

public ParameterTranslations getParameterTranslations ()

Return information about any parameters encountered during translation.

Returns
  • The parameter information.

public String getQueryIdentifier ()

Retrieve the query identifier for this translator. The query identifier is used in states collection.

Returns
  • the identifier

public Set getQuerySpaces ()

Returns the set of query spaces (table names) that the query refers to.

Returns
  • A set of query spaces (table names).

public String getQueryString ()

Returns the HQL string processed by the translator.

Returns
  • the HQL string processed by the translator.

public String[] getReturnAliases ()

Returns an array of HQL aliases

public Type[] getReturnTypes ()

Types of the return values of an iterate() style query.

Returns
  • an array of Types.

public String getSQLString ()

The SQL query string to be called; implemented by all subclasses

Returns
  • the SQL string generated by the translator.

public Statement getSqlAST ()

public boolean isManipulationStatement ()

public boolean isShallowQuery ()

public Iterator iterate (QueryParameters queryParameters, EventSource session)

Return the query results as an iterator

Parameters
queryParameters The query bind parameters.
session The session owning this query.
Returns
  • An iterator over the query results.

public List list (SessionImplementor session, QueryParameters queryParameters)

Perform a list operation given the underlying query definition.

Parameters
session The session owning this query.
queryParameters The query bind parameters.
Returns
  • The query list results.

public ScrollableResults scroll (QueryParameters queryParameters, SessionImplementor session)

Return the query results, as an instance of ScrollableResults

Parameters
queryParameters The query bind parameters.
session The session owning this query.
Returns
  • The ScrollableResults wrapper around the query results.

public void validateScrollability ()

Validate the scrollability of the translated query.