类 QueryTranslatorImpl
- java.lang.Object
-
- org.hibernate.hql.internal.ast.QueryTranslatorImpl
-
- 所有已实现的接口:
FilterTranslator,QueryTranslator
public class QueryTranslatorImpl extends Object implements FilterTranslator
A QueryTranslator that uses an Antlr-based parser.- 作者:
- Joshua Davis (pgmjsd@sourceforge.net)
-
-
嵌套类概要
嵌套类 修饰符和类型 类 说明 static classQueryTranslatorImpl.JavaConstantConverter
-
构造器概要
构造器 构造器 说明 QueryTranslatorImpl(String queryIdentifier, String query, Map enabledFilters, SessionFactoryImplementor factory)Creates a new AST-based query translator.QueryTranslatorImpl(String queryIdentifier, String query, Map enabledFilters, SessionFactoryImplementor factory, EntityGraphQueryHint entityGraphQueryHint)
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 List<String>collectSqlStrings()voidcompile(String collectionRole, Map replacements, boolean shallow)Compile a filter.voidcompile(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.List<ParameterSpecification>getCollectedParameterSpecifications()String[][]getColumnNames()Returns the column names in the generated SQL.ClassgetDynamicInstantiationResultType()MapgetEnabledFilters()Returns the filters enabled for this query translator.EntityGraphQueryHintgetEntityGraphQueryHint()int[]getNamedParameterLocs(String name)ParameterTranslationsgetParameterTranslations()Return information about any parameters encountered during translation.List<String>getPrimaryFromClauseTables()StringgetQueryIdentifier()Retrieve the query identifier for this translator.Set<Serializable>getQuerySpaces()Returns the set of query spaces (table names) that the query refers to.StringgetQueryString()Returns the HQL string processed by the translator.String[]getReturnAliases()Returns an array of HQL aliasesType[]getReturnTypes()Types of the return values of an iterate() style query.StatementgetSqlAST()StringgetSQLString()The SQL query string to be called; implemented by all subclassesbooleanisManipulationStatement()booleanisShallowQuery()booleanisUpdateStatement()Iteratoriterate(QueryParameters queryParameters, EventSource session)Return the query results as an iteratorListlist(SharedSessionContractImplementor session, QueryParameters queryParameters)Perform a list operation given the underlying query definition.ScrollableResultsImplementorscroll(QueryParameters queryParameters, SharedSessionContractImplementor session)Return the query results, as an instance of ScrollableResultsvoidsetEntityGraphQueryHint(EntityGraphQueryHint entityGraphQueryHint)voidvalidateScrollability()Validate the scrollability of the translated query.
-
-
-
构造器详细资料
-
QueryTranslatorImpl
public QueryTranslatorImpl(String queryIdentifier, String query, Map enabledFilters, SessionFactoryImplementor factory)
Creates a new AST-based query translator.- 参数:
queryIdentifier- The query-identifier (used in stats collection)query- The hql query to translateenabledFilters- Currently enabled filtersfactory- The session factory constructing this translator instance.
-
QueryTranslatorImpl
public QueryTranslatorImpl(String queryIdentifier, String query, Map enabledFilters, SessionFactoryImplementor factory, EntityGraphQueryHint entityGraphQueryHint)
-
-
方法详细资料
-
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.- 指定者:
compile在接口中QueryTranslator- 参数:
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.
-
compile
public void compile(String collectionRole, Map replacements, boolean shallow) throws QueryException, MappingException
Compile a filter. This method may be called multiple times. Subsequent invocations are no-ops.- 指定者:
compile在接口中FilterTranslator- 参数:
collectionRole- 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.
-
getQueryIdentifier
public String getQueryIdentifier()
从接口复制的说明:QueryTranslatorRetrieve the query identifier for this translator. The query identifier is used in states collection.- 指定者:
getQueryIdentifier在接口中QueryTranslator- 返回:
- the identifier
-
getSqlAST
public Statement getSqlAST()
-
getReturnTypes
public Type[] getReturnTypes()
Types of the return values of an iterate() style query.- 指定者:
getReturnTypes在接口中QueryTranslator- 返回:
- an array of Types.
-
getReturnAliases
public String[] getReturnAliases()
从接口复制的说明:QueryTranslatorReturns an array of HQL aliases- 指定者:
getReturnAliases在接口中QueryTranslator
-
getColumnNames
public String[][] getColumnNames()
从接口复制的说明:QueryTranslatorReturns the column names in the generated SQL.- 指定者:
getColumnNames在接口中QueryTranslator- 返回:
- the column names in the generated SQL.
-
getQuerySpaces
public Set<Serializable> getQuerySpaces()
从接口复制的说明:QueryTranslatorReturns the set of query spaces (table names) that the query refers to.- 指定者:
getQuerySpaces在接口中QueryTranslator- 返回:
- A set of query spaces (table names).
-
list
public List list(SharedSessionContractImplementor session, QueryParameters queryParameters) throws HibernateException
从接口复制的说明:QueryTranslatorPerform a list operation given the underlying query definition.- 指定者:
list在接口中QueryTranslator- 参数:
session- The session owning this query.queryParameters- The query bind parameters.- 返回:
- The query list results.
- 抛出:
HibernateException
-
iterate
public Iterator iterate(QueryParameters queryParameters, EventSource session) throws HibernateException
Return the query results as an iterator- 指定者:
iterate在接口中QueryTranslator- 参数:
queryParameters- The query bind parameters.session- The session owning this query.- 返回:
- An iterator over the query results.
- 抛出:
HibernateException
-
scroll
public ScrollableResultsImplementor scroll(QueryParameters queryParameters, SharedSessionContractImplementor session) throws HibernateException
Return the query results, as an instance of ScrollableResults- 指定者:
scroll在接口中QueryTranslator- 参数:
queryParameters- The query bind parameters.session- The session owning this query.- 返回:
- The ScrollableResults wrapper around the query results.
- 抛出:
HibernateException
-
executeUpdate
public int executeUpdate(QueryParameters queryParameters, SharedSessionContractImplementor session) throws HibernateException
从接口复制的说明:QueryTranslatorPerform a bulk update/delete operation given the underlying query definition.- 指定者:
executeUpdate在接口中QueryTranslator- 参数:
queryParameters- The query bind parameters.session- The session owning this query.- 返回:
- The number of entities updated or deleted.
- 抛出:
HibernateException
-
getSQLString
public String getSQLString()
The SQL query string to be called; implemented by all subclasses- 指定者:
getSQLString在接口中QueryTranslator- 返回:
- the SQL string generated by the translator.
-
collectSqlStrings
public List<String> collectSqlStrings()
- 指定者:
collectSqlStrings在接口中QueryTranslator
-
isShallowQuery
public boolean isShallowQuery()
-
getQueryString
public String getQueryString()
从接口复制的说明:QueryTranslatorReturns the HQL string processed by the translator.- 指定者:
getQueryString在接口中QueryTranslator- 返回:
- the HQL string processed by the translator.
-
getEnabledFilters
public Map getEnabledFilters()
从接口复制的说明:QueryTranslatorReturns the filters enabled for this query translator.- 指定者:
getEnabledFilters在接口中QueryTranslator- 返回:
- Filters enabled for this query execution.
-
getNamedParameterLocs
public int[] getNamedParameterLocs(String name)
-
containsCollectionFetches
public boolean containsCollectionFetches()
从接口复制的说明:QueryTranslatorDoes the translated query contain collection fetches?- 指定者:
containsCollectionFetches在接口中QueryTranslator- 返回:
- true if the query does contain collection fetched; false otherwise.
-
isManipulationStatement
public boolean isManipulationStatement()
- 指定者:
isManipulationStatement在接口中QueryTranslator
-
isUpdateStatement
public boolean isUpdateStatement()
- 指定者:
isUpdateStatement在接口中QueryTranslator
-
getPrimaryFromClauseTables
public List<String> getPrimaryFromClauseTables()
- 指定者:
getPrimaryFromClauseTables在接口中QueryTranslator
-
validateScrollability
public void validateScrollability() throws HibernateException从接口复制的说明:QueryTranslatorValidate the scrollability of the translated query.- 指定者:
validateScrollability在接口中QueryTranslator- 抛出:
HibernateException
-
getParameterTranslations
public ParameterTranslations getParameterTranslations()
从接口复制的说明:QueryTranslatorReturn information about any parameters encountered during translation.- 指定者:
getParameterTranslations在接口中QueryTranslator- 返回:
- The parameter information.
-
getCollectedParameterSpecifications
public List<ParameterSpecification> getCollectedParameterSpecifications()
-
getDynamicInstantiationResultType
public Class getDynamicInstantiationResultType()
-
getEntityGraphQueryHint
public EntityGraphQueryHint getEntityGraphQueryHint()
-
setEntityGraphQueryHint
public void setEntityGraphQueryHint(EntityGraphQueryHint entityGraphQueryHint)
-
-