public class QueryTranslatorImpl extends Object implements FilterTranslator
| Modifier and Type | Class and Description |
|---|---|
static class |
QueryTranslatorImpl.JavaConstantConverter |
ERROR_CANNOT_DETERMINE_TYPE, ERROR_CANNOT_FETCH_WITH_ITERATE, ERROR_CANNOT_FORMAT_LITERAL, ERROR_NAMED_PARAMETER_DOES_NOT_APPEAR| Constructor and Description |
|---|
QueryTranslatorImpl(String queryIdentifier,
String query,
Map enabledFilters,
SessionFactoryImplementor factory)
Creates a new AST-based query translator.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
public QueryTranslatorImpl(String queryIdentifier, String query, Map enabledFilters, SessionFactoryImplementor factory)
queryIdentifier - The query-identifier (used in stats collection)query - The hql query to translateenabledFilters - Currently enabled filtersfactory - The session factory constructing this translator instance.public void compile(Map replacements, boolean shallow) throws QueryException, MappingException
compile in interface QueryTranslatorreplacements - Defined query substitutions.shallow - Does this represent a shallow (scalar or entity-id) select?QueryException - There was a problem parsing the query string.MappingException - There was a problem querying defined mappings.public void compile(String collectionRole, Map replacements, boolean shallow) throws QueryException, MappingException
compile in interface FilterTranslatorcollectionRole - 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?QueryException - There was a problem parsing the query string.MappingException - There was a problem querying defined mappings.public String getQueryIdentifier()
QueryTranslatorgetQueryIdentifier in interface QueryTranslatorpublic Statement getSqlAST()
public Type[] getReturnTypes()
getReturnTypes in interface QueryTranslatorpublic String[] getReturnAliases()
QueryTranslatorgetReturnAliases in interface QueryTranslatorpublic String[][] getColumnNames()
QueryTranslatorgetColumnNames in interface QueryTranslatorpublic Set getQuerySpaces()
QueryTranslatorgetQuerySpaces in interface QueryTranslatorpublic List list(SessionImplementor session, QueryParameters queryParameters) throws HibernateException
QueryTranslatorlist in interface QueryTranslatorsession - The session owning this query.queryParameters - The query bind parameters.HibernateExceptionpublic Iterator iterate(QueryParameters queryParameters, EventSource session) throws HibernateException
iterate in interface QueryTranslatorqueryParameters - The query bind parameters.session - The session owning this query.HibernateExceptionpublic ScrollableResults scroll(QueryParameters queryParameters, SessionImplementor session) throws HibernateException
scroll in interface QueryTranslatorqueryParameters - The query bind parameters.session - The session owning this query.HibernateExceptionpublic int executeUpdate(QueryParameters queryParameters, SessionImplementor session) throws HibernateException
QueryTranslatorexecuteUpdate in interface QueryTranslatorqueryParameters - The query bind parameters.session - The session owning this query.HibernateExceptionpublic String getSQLString()
getSQLString in interface QueryTranslatorpublic List<String> collectSqlStrings()
collectSqlStrings in interface QueryTranslatorpublic boolean isShallowQuery()
public String getQueryString()
QueryTranslatorgetQueryString in interface QueryTranslatorpublic Map getEnabledFilters()
QueryTranslatorgetEnabledFilters in interface QueryTranslatorpublic int[] getNamedParameterLocs(String name)
public boolean containsCollectionFetches()
QueryTranslatorcontainsCollectionFetches in interface QueryTranslatorpublic boolean isManipulationStatement()
isManipulationStatement in interface QueryTranslatorpublic void validateScrollability()
throws HibernateException
QueryTranslatorvalidateScrollability in interface QueryTranslatorHibernateExceptionpublic ParameterTranslations getParameterTranslations()
QueryTranslatorgetParameterTranslations in interface QueryTranslatorpublic List getCollectedParameterSpecifications()
public Class getDynamicInstantiationResultType()
getDynamicInstantiationResultType in interface QueryTranslatorCopyright © 2012 JBoss by Red Hat. All Rights Reserved.