org.hibernate.hql
Interface QueryTranslator

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

public interface QueryTranslator

Defines the constract of an HQL->SQL translator.

Author:
josh Mar 14, 2004 11:14:21 AM

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
 void compile(Map replacements, boolean shallow)
          Compile a "normal" query.
 int executeUpdate(QueryParameters queryParameters, SessionImplementor session)
          Perform a bulk update/delete operation given the underlying query defintion.
 String[][] getColumnNames()
          Returns the column names in the generated SQL.
 Map getEnabledFilters()
          Returns the filters enabled for this query translator.
 int[] getNamedParameterLocs(String name)
          Returns the locations of the specified named parameter in the SQL.
 Set getQuerySpaces()
          Returns the set of query spaces (table names) that the query referrs 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.
 Iterator iterate(QueryParameters queryParameters, SessionImplementor session)
          Perform an iterate operation given the underlying query defintion.
 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 defintion.
 

Field Detail

ERROR_CANNOT_FETCH_WITH_ITERATE

public static final String ERROR_CANNOT_FETCH_WITH_ITERATE
See Also:
Constant Field Values

ERROR_NAMED_PARAMETER_DOES_NOT_APPEAR

public static final String ERROR_NAMED_PARAMETER_DOES_NOT_APPEAR
See Also:
Constant Field Values

ERROR_CANNOT_DETERMINE_TYPE

public static final String ERROR_CANNOT_DETERMINE_TYPE
See Also:
Constant Field Values

ERROR_CANNOT_FORMAT_LITERAL

public static final String ERROR_CANNOT_FORMAT_LITERAL
See Also:
Constant Field Values
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.

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

public 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

public Iterator iterate(QueryParameters queryParameters,
                        SessionImplementor session)
                 throws HibernateException
Perform an iterate operation given the underlying query defintion.

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
Perform a scroll operation given the underlying query defintion.

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
Perform a bulk update/delete operation given the underlying query defintion.

Parameters:
queryParameters - The query bind parameters.
session - The session owning this query.
Returns:
The number of entities updated or deleted.
Throws:
HibernateException

getQuerySpaces

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

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

getSQLString

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

Returns:
the SQL string generated by the translator.

getQueryString

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

Returns:
the HQL string processed by the translator.

getEnabledFilters

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

Returns:
Filters enabled for this query execution.

getReturnTypes

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

Returns:
Query return types.

getReturnAliases

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


getColumnNames

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

Returns:
the column names in the generated SQL.

getNamedParameterLocs

public int[] getNamedParameterLocs(String name)
                            throws QueryException
Returns the locations of the specified named parameter in the SQL.

Parameters:
name - The name of the named parameter.
Returns:
the locations of the specified named parameter in the SQL.
Throws:
QueryException - if something goes wrong.