public class QueryTranslatorImpl extends BasicLoader implements FilterTranslator
Loader.SqlStatementWrapperNO_SUFFIXDEBUG_ENABLEDERROR_CANNOT_DETERMINE_TYPE, ERROR_CANNOT_FETCH_WITH_ITERATE, ERROR_CANNOT_FORMAT_LITERAL, ERROR_NAMED_PARAMETER_DOES_NOT_APPEAR| Constructor and Description |
|---|
QueryTranslatorImpl(java.lang.String queryString,
java.util.Map enabledFilters,
SessionFactoryImplementor factory)
Construct a query translator; this form used internally.
|
QueryTranslatorImpl(java.lang.String queryIdentifier,
java.lang.String queryString,
java.util.Map enabledFilters,
SessionFactoryImplementor factory)
Construct a query translator
|
| Modifier and Type | Method and Description |
|---|---|
protected java.lang.String |
applyLocks(java.lang.String sql,
QueryParameters parameters,
Dialect dialect,
java.util.List<AfterLoadAction> afterLoadActions)
Append FOR UPDATE OF clause, if necessary.
|
java.util.List<java.lang.String> |
collectSqlStrings() |
void |
compile(java.util.Map replacements,
boolean scalar)
Compile a "normal" query.
|
void |
compile(java.lang.String collectionRole,
java.util.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 java.lang.String[] |
getAliases()
Get the SQL table aliases of entities whose
associations are subselect-loadable, returning
null if this loader does not support subselect
loading
|
java.lang.String |
getAliasName(java.lang.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()
An (optional) persister for a collection to be initialized; only
collection loaders return a non-null value
|
protected java.lang.String[] |
getCollectionSuffixes() |
java.lang.String[][] |
getColumnNames()
Returns the column names in the generated SQL.
|
java.lang.Class |
getDynamicInstantiationResultType() |
java.util.Map |
getEnabledFilters()
Returns the filters enabled for this query translator.
|
protected Loadable[] |
getEntityPersisters()
Persisters for the return values of a find() style query.
|
java.lang.Class |
getHolderClass() |
protected LockMode[] |
getLockModes(LockOptions lockOptions)
What lock options does this load entities with?
|
int[] |
getNamedParameterLocs(java.lang.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.
|
java.lang.String |
getQueryIdentifier()
Identifies the query for statistics reporting, if null,
no statistics will be reported
|
java.util.Set<java.io.Serializable> |
getQuerySpaces()
Returns the set of query spaces (table names) that the query refers to.
|
java.lang.String |
getQueryString()
Returns the HQL string processed by the translator.
|
protected java.lang.Object |
getResultColumnOrRow(java.lang.Object[] row,
ResultTransformer transformer,
java.sql.ResultSet rs,
SessionImplementor session)
Get the actual object that is returned in the user-visible result list.
|
protected java.util.List |
getResultList(java.util.List results,
ResultTransformer resultTransformer) |
protected java.lang.Object[] |
getResultRow(java.lang.Object[] row,
java.sql.ResultSet rs,
SessionImplementor session) |
java.lang.String[] |
getReturnAliases()
Returns an array of HQL aliases
|
Type[] |
getReturnTypes()
Types of the return values of an iterate() style query.
|
java.lang.String |
getSQLString()
The SQL query string to be called; implemented by all subclasses
|
protected java.lang.String[] |
getSuffixes() |
protected boolean[] |
includeInResultRow() |
protected boolean |
isCompiled() |
boolean |
isManipulationStatement() |
protected boolean |
isSubselectLoadingEnabled() |
java.util.Iterator |
iterate(QueryParameters queryParameters,
EventSource session)
Return the query results as an iterator
|
java.util.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.
|
java.lang.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, determineFollowOnLockMode, doList, doQueryAndInitializeNonLazyCollections, doQueryAndInitializeNonLazyCollections, executeQueryStatement, executeQueryStatement, extractKeysFromResultSet, getCompositeKeyManyToOneTargetIndices, getEntityEagerPropertyFetches, getFactory, getLimitHandler, getResultRowAliases, getResultSet, hasSubselectLoadableCollections, isSingleRowLoader, list, loadCollection, loadCollectionBatch, loadCollectionSubselect, loadEntity, loadEntity, loadEntityBatch, loadSequentialRowsForward, loadSequentialRowsReverse, loadSingleRow, needsFetchingScroll, prepareQueryStatement, preprocessSQL, processResultSet, putResultInQueryCache, scroll, shouldUseFollowOnLockingpublic QueryTranslatorImpl(java.lang.String queryIdentifier,
java.lang.String queryString,
java.util.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(java.lang.String queryString,
java.util.Map enabledFilters,
SessionFactoryImplementor factory)
queryString - The query string to process.enabledFilters - Any enabled filters.factory - The session factory.public void compile(java.util.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(java.lang.String collectionRole,
java.util.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 java.lang.String getSQLString()
LoadergetSQLString in interface QueryTranslatorgetSQLString in class LoaderResultSet.public java.util.List<java.lang.String> collectSqlStrings()
collectSqlStrings in interface QueryTranslatorpublic java.lang.String getQueryString()
QueryTranslatorgetQueryString in interface QueryTranslatorprotected Loadable[] getEntityPersisters()
getEntityPersisters in class Loaderpublic Type[] getReturnTypes()
getReturnTypes in interface QueryTranslatorpublic java.lang.String[] getReturnAliases()
QueryTranslatorgetReturnAliases in interface QueryTranslatorpublic java.lang.String[][] getColumnNames()
QueryTranslatorgetColumnNames in interface QueryTranslatorpublic java.lang.String getAliasName(java.lang.String alias)
public int[] getNamedParameterLocs(java.lang.String name)
throws QueryException
getNamedParameterLocs in class LoaderQueryExceptionpublic final java.util.Set<java.io.Serializable> getQuerySpaces()
QueryTranslatorgetQuerySpaces in interface QueryTranslatorpublic CollectionPersister[] getCollectionPersisters()
LoadergetCollectionPersisters in class Loaderprotected java.lang.String[] getCollectionSuffixes()
getCollectionSuffixes in class BasicLoaderprotected java.lang.String[] getSuffixes()
getSuffixes in class BasicLoaderprotected java.lang.String[] getAliases()
LoadergetAliases in class Loaderpublic java.util.List list(SessionImplementor session, QueryParameters queryParameters) throws HibernateException
QueryTranslatorlist in interface QueryTranslatorsession - The session owning this query.queryParameters - The query bind parameters.HibernateExceptionpublic java.util.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 java.lang.Object getResultColumnOrRow(java.lang.Object[] row,
ResultTransformer transformer,
java.sql.ResultSet rs,
SessionImplementor session)
throws java.sql.SQLException,
HibernateException
LoadergetResultColumnOrRow in class Loaderjava.sql.SQLExceptionHibernateExceptionprotected java.lang.Object[] getResultRow(java.lang.Object[] row,
java.sql.ResultSet rs,
SessionImplementor session)
throws java.sql.SQLException,
HibernateException
getResultRow in class Loaderjava.sql.SQLExceptionHibernateExceptionprotected java.util.List getResultList(java.util.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 java.lang.String applyLocks(java.lang.String sql,
QueryParameters parameters,
Dialect dialect,
java.util.List<AfterLoadAction> afterLoadActions)
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 java.lang.Class getHolderClass()
public java.util.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 java.lang.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 java.lang.Class getDynamicInstantiationResultType()
getDynamicInstantiationResultType in interface QueryTranslatorpublic ParameterTranslations getParameterTranslations()
QueryTranslatorgetParameterTranslations in interface QueryTranslatorCopyright © 2001-2018 Red Hat, Inc. All Rights Reserved.