org.hibernate.hql
Interface QueryTranslator

All Known Subinterfaces:
FilterTranslator
All Known Implementing Classes:
QueryTranslatorImpl, QueryTranslatorImpl

public interface QueryTranslator

Defines the contract of an HQL->SQL translator.

Author:
josh

Field Summary
static String ERROR_CANNOT_DETERMINE_TYPE
           
static String ERROR_CANNOT_FETCH_WITH_ITERATE
           
static String ERROR_CANNOT_FORMAT_LITERAL
           
static String ERROR_NAMED_PARAMETER_DOES_NOT_APPEAR
           
 
Method Summary
 List collectSqlStrings()
           
 void compile(Map replacements, boolean shallow)
          Compile a "normal" query.
 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.
 String[][] getColumnNames()
          Returns the column names in the generated SQL.
 Class getDynamicInstantiationResultType()
           
 Map getEnabledFilters()
          Returns the filters enabled for this query translator.
 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()
          Returns an array of Types represented in the query result.
 String getSQLString()
          Returns the SQL string generated by the translator.
 boolean isManipulationStatement()
           
 Iterator iterate(QueryParameters queryParameters, EventSource session)
          Perform an iterate operation given the underlying query definition.
 List list(SessionImplementor session, QueryParameters queryParameters)
          Perform a list operation given the underlying query definition.
 ScrollableResults scroll(QueryParameters queryParameters, SessionImplementor session)
          Perform a scroll operation given the underlying query definition.
 void validateScrollability()
          Validate the scrollability of the translated query.
 

Field Detail

ERROR_CANNOT_FETCH_WITH_ITERATE

static final String ERROR_CANNOT_FETCH_WITH_ITERATE
See Also:
Constant Field Values

ERROR_NAMED_PARAMETER_DOES_NOT_APPEAR

static final String ERROR_NAMED_PARAMETER_DOES_NOT_APPEAR
See Also:
Constant Field Values

ERROR_CANNOT_DETERMINE_TYPE

static final String ERROR_CANNOT_DETERMINE_TYPE
See Also:
Constant Field Values

ERROR_CANNOT_FORMAT_LITERAL

static final String ERROR_CANNOT_FORMAT_LITERAL
See Also:
Constant Field Values
Method Detail

compile

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.

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.

list

List list(SessionImplementor session,
          QueryParameters queryParameters)
          throws HibernateException
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.
Throws:
HibernateException

iterate

Iterator iterate(QueryParameters queryParameters,
                 EventSource session)
                 throws HibernateException
Perform an iterate operation given the underlying query definition.

Parameters:
queryParameters - The query bind parameters.
session - The session owning this query.
Returns:
An iterator over the query results.
Throws:
HibernateException

scroll

ScrollableResults scroll(QueryParameters queryParameters,
                         SessionImplementor session)
                         throws HibernateException
Perform a scroll operation given the underlying query definition.

Parameters:
queryParameters - The query bind parameters.
session - The session owning this query.
Returns:
The ScrollableResults wrapper around the query results.
Throws:
HibernateException

executeUpdate

int executeUpdate(QueryParameters queryParameters,
                  SessionImplementor session)
                  throws HibernateException
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.
Throws:
HibernateException

getQuerySpaces

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

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

getQueryIdentifier

String getQueryIdentifier()
Retrieve the query identifier for this translator. The query identifier is used in states collection.

Returns:
the identifier

getSQLString

String getSQLString()
Returns the SQL string generated by the translator.

Returns:
the SQL string generated by the translator.

collectSqlStrings

List collectSqlStrings()

getQueryString

String getQueryString()
Returns the HQL string processed by the translator.

Returns:
the HQL string processed by the translator.

getEnabledFilters

Map getEnabledFilters()
Returns the filters enabled for this query translator.

Returns:
Filters enabled for this query execution.

getReturnTypes

Type[] getReturnTypes()
Returns an array of Types represented in the query result.

Returns:
Query return types.

getReturnAliases

String[] getReturnAliases()
Returns an array of HQL aliases


getColumnNames

String[][] getColumnNames()
Returns the column names in the generated SQL.

Returns:
the column names in the generated SQL.

getParameterTranslations

ParameterTranslations getParameterTranslations()
Return information about any parameters encountered during translation.

Returns:
The parameter information.

validateScrollability

void validateScrollability()
                           throws HibernateException
Validate the scrollability of the translated query.

Throws:
HibernateException

containsCollectionFetches

boolean containsCollectionFetches()
Does the translated query contain collection fetches?

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

isManipulationStatement

boolean isManipulationStatement()

getDynamicInstantiationResultType

Class getDynamicInstantiationResultType()


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