站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Hibernate 3.2.3 正式版 API 英文文档

QueryTranslator (Hibernate API Documentation) - Hibernate 3.2.3 正式版 API 英文文档


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

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 defintion.
 String[][] getColumnNames()
          Returns the column names in the generated SQL.
 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 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.
 boolean isManipulationStatement()
           
 Iterator iterate(QueryParameters queryParameters, EventSource 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.
 void validateScrollability()
          Validate the scrollability of the translated query.
 

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,
                        EventSource 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).

getQueryIdentifier

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

Returns:
the identifier

getSQLString

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

Returns:
the SQL string generated by the translator.

collectSqlStrings

public List collectSqlStrings()

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.

getParameterTranslations

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

Returns:
The parameter information.

validateScrollability

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

Throws:
HibernateException

containsCollectionFetches

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

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

isManipulationStatement

public boolean isManipulationStatement()