Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.hibernate.hql.internal.ast
Class QueryTranslatorImpl

    java.lang.Object
      org.hibernate.hql.internal.ast.QueryTranslatorImpl

All Implemented Interfaces:
  FilterTranslator, QueryTranslator

    public class QueryTranslatorImpl

extends Object
implements FilterTranslator

A QueryTranslator that uses an Antlr-based parser.

Nested Class Summary
`static class` | `QueryTranslatorImpl.JavaConstantConverter`

Field Summary

Fields inherited from interface org.hibernate.hql.spi.QueryTranslator
`ERROR_CANNOT_DETERMINE_TYPE, ERROR_CANNOT_FETCH_WITH_ITERATE, ERROR_CANNOT_FORMAT_LITERAL, ERROR_NAMED_PARAMETER_DOES_NOT_APPEAR`

Constructor Summary
`QueryTranslatorImpl(String queryIdentifier, String query, Map enabledFilters, SessionFactoryImplementor factory)` Creates a new AST-based query translator.

Method Summary
`List<String>` | `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.
`Class` | `getDynamicInstantiationResultType()`
`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.
`Statement` | `getSqlAST()`
`String` | `getSQLString()` The SQL query string to be called; implemented by all subclasses
`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.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### QueryTranslatorImpl

    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.

Method Detail

### compile

    public void compile(Map replacements,
                        boolean shallow)
                 throws QueryException,
                        MappingException

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

  Specified by:
    `compile` in interface `QueryTranslator`
  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.

### compile

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

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

  Specified by:
    `compile` in interface `FilterTranslator`
  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.

### getQueryIdentifier

    public String getQueryIdentifier()

  Description copied from interface: `QueryTranslator`
  Retrieve the query identifier for this translator. The query identifier is used in states collection.

  Specified by:
    `getQueryIdentifier` in interface `QueryTranslator`
  Returns:
    the identifier

### getSqlAST

    public Statement getSqlAST()

### getReturnTypes

    public Type[] getReturnTypes()

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

  Specified by:
    `getReturnTypes` in interface `QueryTranslator`
  Returns:
    an array of `Type`s.

### getReturnAliases

    public String[] getReturnAliases()

  Description copied from interface: `QueryTranslator`
  Returns an array of HQL aliases

  Specified by:
    `getReturnAliases` in interface `QueryTranslator`

### getColumnNames

    public String[][] getColumnNames()

  Description copied from interface: `QueryTranslator`
  Returns the column names in the generated SQL.

  Specified by:
    `getColumnNames` in interface `QueryTranslator`
  Returns:
    the column names in the generated SQL.

### getQuerySpaces

    public Set getQuerySpaces()

  Description copied from interface: `QueryTranslator`
  Returns the set of query spaces (table names) that the query refers to.

  Specified by:
    `getQuerySpaces` in interface `QueryTranslator`
  Returns:
    A set of query spaces (table names).

### list

    public List list(SessionImplementor session,
                     QueryParameters queryParameters)
              throws HibernateException

  Description copied from interface: `QueryTranslator`
  Perform a list operation given the underlying query definition.

  Specified by:
    `list` in interface `QueryTranslator`
  Parameters:
    `session` - The session owning this query.
    `queryParameters` - The query bind parameters.
  Returns:
    The query list results.
  Throws:
    `HibernateException`

### iterate

    public Iterator iterate(QueryParameters queryParameters,
                            EventSource session)
                     throws HibernateException

  Return the query results as an iterator

  Specified by:
    `iterate` in interface `QueryTranslator`
  Parameters:
    `queryParameters` - The query bind parameters.
    `session` - The session owning this query.
  Returns:
    An iterator over the query results.
  Throws:
    `HibernateException`

### scroll

    public ScrollableResults scroll(QueryParameters queryParameters,
                                    SessionImplementor session)
                             throws HibernateException

  Return the query results, as an instance of `ScrollableResults`

  Specified by:
    `scroll` in interface `QueryTranslator`
  Parameters:
    `queryParameters` - The query bind parameters.
    `session` - The session owning this query.
  Returns:
    The ScrollableResults wrapper around the query results.
  Throws:
    `HibernateException`

### executeUpdate

    public int executeUpdate(QueryParameters queryParameters,
                             SessionImplementor session)
                      throws HibernateException

  Description copied from interface: `QueryTranslator`
  Perform a bulk update/delete operation given the underlying query definition.

  Specified by:
    `executeUpdate` in interface `QueryTranslator`
  Parameters:
    `queryParameters` - The query bind parameters.
    `session` - The session owning this query.
  Returns:
    The number of entities updated or deleted.
  Throws:
    `HibernateException`

### getSQLString

    public String getSQLString()

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

  Specified by:
    `getSQLString` in interface `QueryTranslator`
  Returns:
    the SQL string generated by the translator.

### collectSqlStrings

    public List<String> collectSqlStrings()

  Specified by:
    `collectSqlStrings` in interface `QueryTranslator`

### isShallowQuery

    public boolean isShallowQuery()

### getQueryString

    public String getQueryString()

  Description copied from interface: `QueryTranslator`
  Returns the HQL string processed by the translator.

  Specified by:
    `getQueryString` in interface `QueryTranslator`
  Returns:
    the HQL string processed by the translator.

### getEnabledFilters

    public Map getEnabledFilters()

  Description copied from interface: `QueryTranslator`
  Returns the filters enabled for this query translator.

  Specified by:
    `getEnabledFilters` in interface `QueryTranslator`
  Returns:
    Filters enabled for this query execution.

### getNamedParameterLocs

    public int[] getNamedParameterLocs(String name)

### containsCollectionFetches

    public boolean containsCollectionFetches()

  Description copied from interface: `QueryTranslator`
  Does the translated query contain collection fetches?

  Specified by:
    `containsCollectionFetches` in interface `QueryTranslator`
  Returns:
    true if the query does contain collection fetched; false otherwise.

### isManipulationStatement

    public boolean isManipulationStatement()

  Specified by:
    `isManipulationStatement` in interface `QueryTranslator`

### validateScrollability

    public void validateScrollability()
                               throws HibernateException

  Description copied from interface: `QueryTranslator`
  Validate the scrollability of the translated query.

  Specified by:
    `validateScrollability` in interface `QueryTranslator`
  Throws:
    `HibernateException`

### getParameterTranslations

    public ParameterTranslations getParameterTranslations()

  Description copied from interface: `QueryTranslator`
  Return information about any parameters encountered during translation.

  Specified by:
    `getParameterTranslations` in interface `QueryTranslator`
  Returns:
    The parameter information.

### getCollectedParameterSpecifications

    public List getCollectedParameterSpecifications()

### getDynamicInstantiationResultType

    public Class getDynamicInstantiationResultType()

  Specified by:
    `getDynamicInstantiationResultType` in interface `QueryTranslator`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2012 Red Hat, Inc. All Rights Reserved.