public class QueryTranslatorImpl extends BasicLoader implements FilterTranslator
NO_SUFFIXERROR_CANNOT_DETERMINE_TYPE, ERROR_CANNOT_FETCH_WITH_ITERATE, ERROR_CANNOT_FORMAT_LITERAL, ERROR_NAMED_PARAMETER_DOES_NOT_APPEAR| Constructor and Description |
|---|
QueryTranslatorImpl(String queryString,
Map enabledFilters,
SessionFactoryImplementor factory)
Construct a query translator; this form used internally.
|
QueryTranslatorImpl(String queryIdentifier,
String queryString,
Map enabledFilters,
SessionFactoryImplementor factory)
Construct a query translator
|
| Modifier and Type | Method and Description |
|---|---|
protected String |
applyLocks(String sql,
LockOptions lockOptions,
Dialect dialect)
Append FOR UPDATE OF clause, if necessary.
|
List<String> |
collectSqlStrings() |
void |
compile(Map replacements,
boolean scalar)
Compile a "normal" query.
|
void |
compile(String collectionRole,
Map replacements,
boolean scalar)
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.
|
protected String[] |
getAliases()
Get the SQL table aliases of entities whose
associations are subselect-loadable, returning
null if this loader does not support subselect
loading
|
String |
getAliasName(String alias) |
protected int[] |
getCollectionOwners()
Get the index of the entity that owns the collection, or -1
if there is no owner in the query results (ie.
|
CollectionPersister[] |
getCollectionPersisters()
Overrides method from Loader
|
protected String[] |
getCollectionSuffixes() |
String[][] |
getColumnNames()
Returns the column names in the generated SQL.
|
Class |
getDynamicInstantiationResultType() |
Map |
getEnabledFilters()
Returns the filters enabled for this query translator.
|
protected Loadable[] |
getEntityPersisters()
Persisters for the return values of a find() style query.
|
Class |
getHolderClass() |
protected LockMode[] |
getLockModes(LockOptions lockOptions)
What lock options does this load entities with?
|
int[] |
getNamedParameterLocs(String name) |
protected EntityType[] |
getOwnerAssociationTypes()
An array of the owner types corresponding to the
Loader.getOwners()
returns. |
protected int[] |
getOwners()
An array of indexes of the entity that owns a one-to-one association
to the entity at the given index (-1 if there is no "owner").
|
ParameterTranslations |
getParameterTranslations()
Return information about any parameters encountered during
translation.
|
String |
getQueryIdentifier()
Identifies the query for statistics reporting, if null,
no statistics will be reported
|
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.
|
protected Object |
getResultColumnOrRow(Object[] row,
ResultTransformer transformer,
ResultSet rs,
SessionImplementor session)
Get the actual object that is returned in the user-visible result list.
|
protected List |
getResultList(List results,
ResultTransformer resultTransformer) |
protected Object[] |
getResultRow(Object[] row,
ResultSet rs,
SessionImplementor session) |
String[] |
getReturnAliases()
Returns an array of HQL aliases
|
Type[] |
getReturnTypes()
Types of the return values of an iterate() style query.
|
String |
getSQLString()
The SQL query string to be called; implemented by all subclasses
|
protected String[] |
getSuffixes() |
protected boolean[] |
includeInResultRow() |
protected boolean |
isCompiled() |
boolean |
isManipulationStatement() |
protected boolean |
isSubselectLoadingEnabled() |
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.
|
protected ResultTransformer |
resolveResultTransformer(ResultTransformer resultTransformer)
Determine the actual ResultTransformer that will be used to
transform query results.
|
ScrollableResults |
scroll(QueryParameters queryParameters,
SessionImplementor session)
Perform a scroll operation given the underlying query definition.
|
String |
toString() |
protected boolean |
upgradeLocks()
Does this query return objects that might be already cached
by the session, whose lock mode may need upgrading
|
void |
validateScrollability()
Validate the scrollability of the translated query.
|
generateSuffixes, generateSuffixes, getCollectionAliases, getEntityAliases, postInstantiateapplyPostLoadLocks, areResultSetRowsTransformedImmediately, autoDiscoverTypes, bindNamedParameters, bindParameterValues, bindPositionalParameters, checkScrollability, doList, extractKeysFromResultSet, getCompositeKeyManyToOneTargetIndices, getEntityEagerPropertyFetches, getFactory, getResultRowAliases, getResultSet, hasSubselectLoadableCollections, isSingleRowLoader, list, loadCollection, loadCollectionBatch, loadCollectionSubselect, loadEntity, loadEntity, loadEntityBatch, loadSequentialRowsForward, loadSequentialRowsReverse, loadSingleRow, needsFetchingScroll, prepareQueryStatement, preprocessSQL, scrollpublic QueryTranslatorImpl(String queryIdentifier, String queryString, Map enabledFilters, SessionFactoryImplementor factory)
queryIdentifier - A unique identifier for the query of which this
translation is part; typically this is the original, user-supplied query string.queryString - The "preprocessed" query string; at the very least
already processed by QuerySplitter.enabledFilters - Any enabled filters.factory - The session factory.public QueryTranslatorImpl(String queryString, Map enabledFilters, SessionFactoryImplementor factory)
queryString - The query string to process.enabledFilters - Any enabled filters.factory - The session factory.public void compile(Map replacements, boolean scalar) throws QueryException, MappingException
compile in interface QueryTranslatorreplacements - Defined query substitutions.scalar - 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 scalar) throws QueryException, MappingException
compile in interface FilterTranslatorcollectionRole - the role name of the collection used as the basis for the filter.replacements - Defined query substitutions.scalar - 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 getSQLString()
LoadergetSQLString in interface QueryTranslatorgetSQLString in class LoaderResultSet.public List<String> collectSqlStrings()
collectSqlStrings in interface QueryTranslatorpublic String getQueryString()
QueryTranslatorgetQueryString in interface QueryTranslatorprotected Loadable[] getEntityPersisters()
getEntityPersisters in class Loaderpublic Type[] getReturnTypes()
getReturnTypes in interface QueryTranslatorpublic String[] getReturnAliases()
QueryTranslatorgetReturnAliases in interface QueryTranslatorpublic String[][] getColumnNames()
QueryTranslatorgetColumnNames in interface QueryTranslatorpublic int[] getNamedParameterLocs(String name) throws QueryException
getNamedParameterLocs in class LoaderQueryExceptionpublic final Set getQuerySpaces()
QueryTranslatorgetQuerySpaces in interface QueryTranslatorpublic CollectionPersister[] getCollectionPersisters()
getCollectionPersisters in class Loaderprotected String[] getCollectionSuffixes()
getCollectionSuffixes in class BasicLoaderprotected String[] getSuffixes()
getSuffixes in class BasicLoaderprotected String[] getAliases()
LoadergetAliases in class Loaderpublic 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 int executeUpdate(QueryParameters queryParameters, SessionImplementor session) throws HibernateException
QueryTranslatorexecuteUpdate in interface QueryTranslatorqueryParameters - The query bind parameters.session - The session owning this query.HibernateExceptionprotected boolean[] includeInResultRow()
includeInResultRow in class Loaderprotected ResultTransformer resolveResultTransformer(ResultTransformer resultTransformer)
LoaderresolveResultTransformer in class LoaderresultTransformer - the specified result transformerprotected Object getResultColumnOrRow(Object[] row, ResultTransformer transformer, ResultSet rs, SessionImplementor session) throws SQLException, HibernateException
LoadergetResultColumnOrRow in class LoaderSQLExceptionHibernateExceptionprotected Object[] getResultRow(Object[] row, ResultSet rs, SessionImplementor session) throws SQLException, HibernateException
getResultRow in class LoaderSQLExceptionHibernateExceptionprotected List getResultList(List results, ResultTransformer resultTransformer) throws QueryException
getResultList in class LoaderQueryExceptionprotected LockMode[] getLockModes(LockOptions lockOptions)
LoadergetLockModes in class LoaderlockOptions - a collection of lock options specified dynamically via the Query interfaceprotected String applyLocks(String sql, LockOptions lockOptions, Dialect dialect) throws QueryException
LoaderapplyLocks in class LoaderQueryExceptionprotected boolean upgradeLocks()
LoaderupgradeLocks in class Loaderprotected int[] getCollectionOwners()
LoadergetCollectionOwners in class Loaderprotected boolean isCompiled()
protected int[] getOwners()
LoaderLoader.getEntityPersisters().protected EntityType[] getOwnerAssociationTypes()
LoaderLoader.getOwners()
returns. Indices indicating no owner would be null here.getOwnerAssociationTypes in class Loaderpublic Class getHolderClass()
public Map getEnabledFilters()
QueryTranslatorgetEnabledFilters in interface QueryTranslatorpublic ScrollableResults scroll(QueryParameters queryParameters, SessionImplementor session) throws HibernateException
QueryTranslatorscroll in interface QueryTranslatorqueryParameters - The query bind parameters.session - The session owning this query.HibernateExceptionpublic String getQueryIdentifier()
LoadergetQueryIdentifier in interface QueryTranslatorgetQueryIdentifier in class Loaderprotected boolean isSubselectLoadingEnabled()
isSubselectLoadingEnabled in class Loaderpublic void validateScrollability()
throws HibernateException
QueryTranslatorvalidateScrollability in interface QueryTranslatorHibernateExceptionpublic boolean containsCollectionFetches()
QueryTranslatorcontainsCollectionFetches in interface QueryTranslatorpublic boolean isManipulationStatement()
isManipulationStatement in interface QueryTranslatorpublic Class getDynamicInstantiationResultType()
getDynamicInstantiationResultType in interface QueryTranslatorpublic ParameterTranslations getParameterTranslations()
QueryTranslatorgetParameterTranslations in interface QueryTranslatorCopyright © 2012 JBoss by Red Hat. All Rights Reserved.