Package org.hibernate.hql.spi
Interface QueryTranslator
-
- All Known Subinterfaces:
FilterTranslator
public interface QueryTranslatorDefines the contract of an HQL->SQL translator.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringERROR_CANNOT_DETERMINE_TYPEstatic java.lang.StringERROR_CANNOT_FETCH_WITH_ITERATEstatic java.lang.StringERROR_CANNOT_FORMAT_LITERALstatic java.lang.StringERROR_LEGACY_ORDINAL_PARAMS_NO_LONGER_SUPPORTEDstatic java.lang.StringERROR_NAMED_PARAMETER_DOES_NOT_APPEARstatic java.lang.StringERROR_ORDINAL_PARAMETER_DOES_NOT_APPEAR
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description java.util.List<java.lang.String>collectSqlStrings()voidcompile(java.util.Map replacements, boolean shallow)Compile a "normal" query.booleancontainsCollectionFetches()Does the translated query contain collection fetches?intexecuteUpdate(QueryParameters queryParameters, SharedSessionContractImplementor session)Perform a bulk update/delete operation given the underlying query definition.java.lang.String[][]getColumnNames()Returns the column names in the generated SQL.java.lang.ClassgetDynamicInstantiationResultType()java.util.MapgetEnabledFilters()Returns the filters enabled for this query translator.ParameterTranslationsgetParameterTranslations()Return information about any parameters encountered during translation.default java.util.List<java.lang.String>getPrimaryFromClauseTables()java.lang.StringgetQueryIdentifier()Retrieve the query identifier for this translator.java.util.Set<java.io.Serializable>getQuerySpaces()Returns the set of query spaces (table names) that the query refers to.java.lang.StringgetQueryString()Returns the HQL string processed by the translator.java.lang.String[]getReturnAliases()Returns an array of HQL aliasesType[]getReturnTypes()Returns an array of Types represented in the query result.java.lang.StringgetSQLString()Returns the SQL string generated by the translator.booleanisManipulationStatement()default booleanisUpdateStatement()java.util.Iteratoriterate(QueryParameters queryParameters, EventSource session)Perform an iterate operation given the underlying query definition.java.util.Listlist(SharedSessionContractImplementor session, QueryParameters queryParameters)Perform a list operation given the underlying query definition.ScrollableResultsImplementorscroll(QueryParameters queryParameters, SharedSessionContractImplementor session)Perform a scroll operation given the underlying query definition.voidvalidateScrollability()Validate the scrollability of the translated query.
-
-
-
Field Detail
-
ERROR_CANNOT_FETCH_WITH_ITERATE
static final java.lang.String ERROR_CANNOT_FETCH_WITH_ITERATE
- See Also:
- Constant Field Values
-
ERROR_NAMED_PARAMETER_DOES_NOT_APPEAR
static final java.lang.String ERROR_NAMED_PARAMETER_DOES_NOT_APPEAR
- See Also:
- Constant Field Values
-
ERROR_ORDINAL_PARAMETER_DOES_NOT_APPEAR
static final java.lang.String ERROR_ORDINAL_PARAMETER_DOES_NOT_APPEAR
- See Also:
- Constant Field Values
-
ERROR_LEGACY_ORDINAL_PARAMS_NO_LONGER_SUPPORTED
static final java.lang.String ERROR_LEGACY_ORDINAL_PARAMS_NO_LONGER_SUPPORTED
- See Also:
- Constant Field Values
-
ERROR_CANNOT_DETERMINE_TYPE
static final java.lang.String ERROR_CANNOT_DETERMINE_TYPE
- See Also:
- Constant Field Values
-
ERROR_CANNOT_FORMAT_LITERAL
static final java.lang.String ERROR_CANNOT_FORMAT_LITERAL
- See Also:
- Constant Field Values
-
-
Method Detail
-
compile
void compile(java.util.Map replacements, boolean shallow) throws QueryException, MappingExceptionCompile 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
java.util.List list(SharedSessionContractImplementor 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
java.util.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
ScrollableResultsImplementor scroll(QueryParameters queryParameters, SharedSessionContractImplementor 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, SharedSessionContractImplementor 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
java.util.Set<java.io.Serializable> getQuerySpaces()
Returns the set of query spaces (table names) that the query refers to.- Returns:
- A set of query spaces (table names).
-
getQueryIdentifier
java.lang.String getQueryIdentifier()
Retrieve the query identifier for this translator. The query identifier is used in states collection.- Returns:
- the identifier
-
getSQLString
java.lang.String getSQLString()
Returns the SQL string generated by the translator.- Returns:
- the SQL string generated by the translator.
-
collectSqlStrings
java.util.List<java.lang.String> collectSqlStrings()
-
getQueryString
java.lang.String getQueryString()
Returns the HQL string processed by the translator.- Returns:
- the HQL string processed by the translator.
-
getEnabledFilters
java.util.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
java.lang.String[] getReturnAliases()
Returns an array of HQL aliases
-
getColumnNames
java.lang.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 HibernateExceptionValidate 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()
-
isUpdateStatement
default boolean isUpdateStatement()
-
getPrimaryFromClauseTables
default java.util.List<java.lang.String> getPrimaryFromClauseTables()
-
getDynamicInstantiationResultType
java.lang.Class getDynamicInstantiationResultType()
-
-