Class HibernateOrmSearchQueryAdapter<R>
java.lang.Object
org.hibernate.query.spi.AbstractCommonQueryContract
org.hibernate.query.spi.AbstractSelectionQuery<R>
org.hibernate.query.spi.AbstractQuery<R>
org.hibernate.search.mapper.orm.search.query.impl.HibernateOrmSearchQueryAdapter<R>
- All Implemented Interfaces:
Query,TypedQuery<R>,CommonQueryContract,MutationQuery,Query<R>,SelectionQuery<R>,DomainQueryExecutionContext,QueryImplementor<R>
@SuppressForbiddenApis(reason="We need to use the internal QueryOptionsImpl in order to implement a org.hibernate.query.Query")
public final class HibernateOrmSearchQueryAdapter<R>
extends AbstractQuery<R>
-
Field Summary
Fields inherited from class org.hibernate.query.spi.AbstractSelectionQuery
CRITERIA_HQL_STRING -
Method Summary
Modifier and TypeMethodDescriptionapplyGraph(RootGraph graph, GraphSemantic semantic) Apply the given graph using the given semanticprotected voidstatic <R> HibernateOrmSearchQueryAdapter<R>create(SearchQuery<R> query) protected intdoList()protected ScrollableResultsImplementor<R>doScroll(ScrollMode scrollMode) intExecute an insert, update, or delete statement, and return the number of affected entities.getHints()Get the properties and hints and associated values that are in effect for the query instance.getKeyedResultList(KeyedPage<R> page) Execute the query and return the results for the given page, using key-based pagination.Get the rootLockModeTypefor the queryTheLockOptionscurrently in effect for the queryAccess to information about query parameters.The domain parameter bindingsThe query as a string, ornullin the case of a criteria query.longDetermine the size of the query result list that would be returned by callingSelectionQuery.getResultList()with no offset or limit applied to the query.list()Execute the query and return the query results as aList.protected <P> QueryParameterBinding<P>locateBinding(int position) protected <P> QueryParameterBinding<P>locateBinding(Parameter<P> parameter) protected <P> QueryParameterBinding<P>locateBinding(String name) protected <P> QueryParameterBinding<P>locateBinding(QueryParameterImplementor<P> parameter) scroll()Returns scrollable access to the query results.Set a hint.setLockMode(LockModeType lockModeType) Specify the root LockModeType for the querysetLockMode(String alias, LockMode lockMode) Specify aLockModeto apply to a specific alias defined in the querysetResultListTransformer(ResultListTransformer<R> resultListTransformer) Set aResultListTransformer.setTimeout(int timeout) Set the query timeout in seconds.<T> QueryImplementor<T>setTupleTransformer(TupleTransformer<T> transformer) Set aTupleTransformer.toString()<T> TReturn an object of the specified type to allow access to the provider-specific API.Methods inherited from class org.hibernate.query.spi.AbstractQuery
addQueryHint, applyOptions, collectHints, disableFetchProfile, enableFetchProfile, getComment, getFirstResult, getFlushMode, getMaxResults, getParameters, getQueryOptions, getSupportedHints, isCacheable, prepareForExecution, resolveJdbcParameterTypeIfNecessary, setCacheable, setCacheMode, setCacheRegion, setCacheRetrieveMode, setCacheStoreMode, setComment, setEntityGraph, setFetchSize, setFirstResult, setFlushMode, setHibernateFlushMode, setLockOptions, setMaxResults, setOptionalEntityName, setOptionalId, setOptionalObject, setOrder, setOrder, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameterList, setParameterList, setParameterList, setParameterList, setParameterList, setParameterList, setParameterList, setParameterList, setParameterList, setParameterList, setParameterList, setParameterList, setParameterList, setParameterList, setParameterList, setParameterList, setParameterList, setParameterList, setProperties, setProperties, setQueryPlanCacheable, setReadOnlyMethods inherited from class org.hibernate.query.spi.AbstractSelectionQuery
afterQuery, afterQuery, afterQueryHandlingFetchProfiles, beforeQueryHandlingFetchProfiles, getCacheMode, getCacheRegion, getCacheRetrieveMode, getCacheStoreMode, getCallback, getFetchSize, getHibernateLockMode, getResultStream, getSessionFactory, getSingleResult, getSingleResultOrNull, hasCallbackActions, isQueryPlanCacheable, isReadOnly, requiresTxn, resetCallback, scroll, setAliasSpecificLockMode, setFollowOnLocking, setHibernateLockMode, stream, uniqueElement, uniqueResult, uniqueResultOptionalMethods inherited from class org.hibernate.query.spi.AbstractCommonQueryContract
applyAdditionalPossibleHints, applyAliasSpecificLockModeHint, applyCacheableHint, applyCacheModeHint, applyCacheRegionHint, applyCommentHint, applyDatabaseHint, applyEntityGraphHint, applyFetchSizeHint, applyFirstResult, applyFlushModeHint, applyFollowOnLockingHint, applyGraph, applyGraph, applyHibernateLockMode, applyHint, applyJpaCacheRetrieveModeHint, applyJpaCacheStoreModeHint, applyJpaFlushMode, applyLockModeHint, applyLockModeType, applyLockTimeoutHint, applyLockTimeoutHint, applyMaxResults, applyQueryPlanCacheableHint, applyResultListTransformer, applySelectionHint, applySynchronizeSpacesHint, applyTimeoutHint, applyTupleTransformer, determineType, getHibernateFlushMode, getIntegerLiteral, getJpaFlushMode, getMaxRows, getParameter, getParameter, getParameter, getParameter, getParameterValue, getParameterValue, getParameterValue, getSession, getTimeout, isBound, putIfNotNull, putIfNotNullMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.hibernate.query.CommonQueryContract
getHibernateFlushMode, getTimeoutMethods inherited from interface org.hibernate.query.spi.DomainQueryExecutionContext
getResultType, getSessionMethods inherited from interface jakarta.persistence.Query
getParameter, getParameter, getParameter, getParameter, getParameterValue, getParameterValue, getParameterValue, isBoundMethods inherited from interface org.hibernate.query.Query
applyFetchGraph, applyLoadGraph, getResultList, getResultStream, getSingleResult, setPage, stream, uniqueResult, uniqueResultOptionalMethods inherited from interface org.hibernate.query.spi.QueryImplementor
getSession, scroll, setResultTransformerMethods inherited from interface org.hibernate.query.SelectionQuery
getCacheMode, getCacheRegion, getCacheRetrieveMode, getCacheStoreMode, getFetchSize, getHibernateLockMode, getSingleResultOrNull, isQueryPlanCacheable, isReadOnly, setAliasSpecificLockMode, setFollowOnLocking, setHibernateLockMode
-
Method Details
-
create
-
toString
-
unwrap
Description copied from interface:QueryReturn an object of the specified type to allow access to the provider-specific API. If the provider's query implementation does not support the specified class, thePersistenceExceptionis thrown.- Parameters:
cls- the class of the object to be returned. This is normally either the underlying query implementation class or an interface that it implements.- Returns:
- an instance of the specified class
-
list
Description copied from interface:SelectionQueryExecute the query and return the query results as aList. If the query contains multiple items in the selection list, then by default each result in the list is packaged in an array of typeObject[].- Specified by:
listin interfaceQuery<R>- Specified by:
listin interfaceSelectionQuery<R>- Overrides:
listin classAbstractSelectionQuery<R>- Returns:
- the result list
-
getQueryString
Description copied from interface:QueryThe query as a string, ornullin the case of a criteria query.- Specified by:
getQueryStringin interfaceQuery<R>- Specified by:
getQueryStringin classAbstractSelectionQuery<R>
-
setHint
Description copied from interface:CommonQueryContractSet a hint. The hints understood by Hibernate are enumerated byAvailableHints.- Specified by:
setHintin interfaceCommonQueryContract- Specified by:
setHintin interfaceMutationQuery- Specified by:
setHintin interfaceQuery- Specified by:
setHintin interfaceQuery<R>- Specified by:
setHintin interfaceSelectionQuery<R>- Specified by:
setHintin interfaceTypedQuery<R>- Overrides:
setHintin classAbstractQuery<R>- Parameters:
hintName- name of property or hintvalue- value for the property or hint- Returns:
- the same query instance
- See Also:
-
setTimeout
Description copied from interface:CommonQueryContractSet the query timeout in seconds.Any value set here is eventually passed directly along to the JDBC statement, which expressly disallows negative values. So negative values should be avoided as a general rule.
A value of zero indicates no timeout.
- Specified by:
setTimeoutin interfaceCommonQueryContract- Specified by:
setTimeoutin interfaceMutationQuery- Specified by:
setTimeoutin interfaceQuery<R>- Specified by:
setTimeoutin interfaceSelectionQuery<R>- Overrides:
setTimeoutin classAbstractQuery<R>- Parameters:
timeout- the timeout in seconds- Returns:
this, for method chaining- See Also:
-
applyGraph
Description copied from interface:QueryApply the given graph using the given semantic- Parameters:
graph- The graph to apply.semantic- The semantic to use when applying the graph
-
scroll
Description copied from interface:SelectionQueryReturns scrollable access to the query results.This form calls
SelectionQuery.scroll(ScrollMode)usingDialect.defaultScrollMode()- Specified by:
scrollin interfaceQuery<R>- Specified by:
scrollin interfaceQueryImplementor<R>- Specified by:
scrollin interfaceSelectionQuery<R>- Overrides:
scrollin classAbstractSelectionQuery<R>
-
getResultCount
public long getResultCount()Description copied from interface:SelectionQueryDetermine the size of the query result list that would be returned by callingSelectionQuery.getResultList()with no offset or limit applied to the query.- Returns:
- the size of the list that would be returned
-
getKeyedResultList
Description copied from interface:SelectionQueryExecute the query and return the results for the given page, using key-based pagination.- Specified by:
getKeyedResultListin interfaceSelectionQuery<R>- Overrides:
getKeyedResultListin classAbstractQuery<R>- Parameters:
page- the key-based specification of the page as an instance ofKeyedPage- Returns:
- the query results and the key of the next page
as an instance of
KeyedResultList - See Also:
-
doScroll
- Specified by:
doScrollin classAbstractSelectionQuery<R>
-
doList
- Specified by:
doListin classAbstractSelectionQuery<R>
-
beforeQuery
protected void beforeQuery()- Overrides:
beforeQueryin classAbstractSelectionQuery<R>
-
getHints
Description copied from interface:QueryGet the properties and hints and associated values that are in effect for the query instance.- Specified by:
getHintsin interfaceQuery- Overrides:
getHintsin classAbstractCommonQueryContract- Returns:
- query properties and hints
-
getParameterMetadata
Description copied from interface:QueryAccess to information about query parameters.- Specified by:
getParameterMetadatain interfaceQuery<R>- Specified by:
getParameterMetadatain classAbstractCommonQueryContract- Returns:
- information about query parameters.
-
getParameterBindings
-
getQueryParameterBindings
Description copied from interface:DomainQueryExecutionContextThe domain parameter bindings- Specified by:
getQueryParameterBindingsin interfaceDomainQueryExecutionContext- Specified by:
getQueryParameterBindingsin classAbstractCommonQueryContract
-
locateBinding
- Overrides:
locateBindingin classAbstractCommonQueryContract
-
locateBinding
- Overrides:
locateBindingin classAbstractCommonQueryContract
-
locateBinding
- Overrides:
locateBindingin classAbstractCommonQueryContract
-
locateBinding
- Overrides:
locateBindingin classAbstractCommonQueryContract
-
setTupleTransformer
Description copied from interface:QuerySet aTupleTransformer.- Specified by:
setTupleTransformerin interfaceQuery<R>- Specified by:
setTupleTransformerin interfaceQueryImplementor<R>- Overrides:
setTupleTransformerin classAbstractQuery<R>
-
setResultListTransformer
Description copied from interface:QuerySet aResultListTransformer.- Specified by:
setResultListTransformerin interfaceQuery<R>- Specified by:
setResultListTransformerin interfaceQueryImplementor<R>- Overrides:
setResultListTransformerin classAbstractQuery<R>
-
setLockMode
Description copied from class:AbstractSelectionQuerySpecify the root LockModeType for the query- Specified by:
setLockModein interfaceQuery- Specified by:
setLockModein interfaceQuery<R>- Specified by:
setLockModein interfaceSelectionQuery<R>- Specified by:
setLockModein interfaceTypedQuery<R>- Overrides:
setLockModein classAbstractQuery<R>- Parameters:
lockModeType- lock mode- Returns:
- the same query instance
- See Also:
-
getLockMode
Description copied from interface:SelectionQueryGet the rootLockModeTypefor the query- Specified by:
getLockModein interfaceQuery- Specified by:
getLockModein interfaceSelectionQuery<R>- Overrides:
getLockModein classAbstractQuery<R>- Returns:
- lock mode
- See Also:
-
getLockOptions
Description copied from interface:SelectionQueryTheLockOptionscurrently in effect for the query- Specified by:
getLockOptionsin interfaceQuery<R>- Specified by:
getLockOptionsin interfaceSelectionQuery<R>- Overrides:
getLockOptionsin classAbstractQuery<R>- Returns:
- The
LockOptionscurrently in effect - See Also:
-
executeUpdate
Description copied from interface:QueryExecute an insert, update, or delete statement, and return the number of affected entities.For use with instances of
MutationQuerycreated usingQueryProducer.createMutationQuery(String),QueryProducer.createNamedMutationQuery(String),QueryProducer.createNativeMutationQuery(String),QueryProducer.createQuery(jakarta.persistence.criteria.CriteriaUpdate), orQueryProducer.createQuery(jakarta.persistence.criteria.CriteriaDelete).- Specified by:
executeUpdatein interfaceMutationQuery- Specified by:
executeUpdatein interfaceQuery- Specified by:
executeUpdatein interfaceQuery<R>- Overrides:
executeUpdatein classAbstractQuery<R>- Returns:
- the number of affected entity instances (may differ from the number of affected rows)
- Throws:
HibernateException- See Also:
-
doExecuteUpdate
protected int doExecuteUpdate()- Specified by:
doExecuteUpdatein classAbstractQuery<R>
-
setLockMode
Description copied from interface:SelectionQuerySpecify aLockModeto apply to a specific alias defined in the query- Specified by:
setLockModein interfaceQuery<R>- Specified by:
setLockModein interfaceSelectionQuery<R>- Overrides:
setLockModein classAbstractQuery<R>- Parameters:
alias- A query aliaslockMode- The lock mode to apply- Returns:
this, for method chaining- See Also:
-