public static interface Mutiny.Query<R>
org.hibernate.query.Query
interface, allowing reactive execution of HQL and JPQL queries. The semantics of operations on this interface are identical to the semantics of the similarly-named operations of Query
, except that the operations are performed asynchronously, returning a Uni
without blocking the calling thread.
Note that javax.persistence.TemporalType
is not supported as an argument for parameter bindings, and so parameters of type Date
or Calendar
should not be used. Instead, datetime types from java.time
should be used as parameters.
javax.persistence.Query
Modifier and Type | Method and Description |
---|---|
<any> | executeUpdate() Asynchronously execute this delete, update, or insert query, returning the updated row count. |
CacheMode | getCacheMode() Obtain the CacheMode in effect for this query. |
String | getCacheRegion() |
int | getFirstResult() |
FlushMode | getFlushMode() Obtain the FlushMode in effect for this query. |
int | getMaxResults() |
<any> | getResultList() Asynchronously execute this query, returning the query results as a List , via a Uni . |
default <any> | getResults() Asynchronously execute this query, returning the query results as a Multi . |
<any> | getSingleResult() Asynchronously execute this query, returning a single row that matches the query, or null if the query returns no results, throwing an exception if the query returns more than one matching row. |
boolean | isCacheable() |
boolean | isReadOnly() |
Mutiny.Query<R> | setCacheable(boolean cacheable) Enable or disable caching of this query result set in the second-level query cache. |
Mutiny.Query<R> | setCacheMode(CacheMode cacheMode) Set the current CacheMode in effect while this query is being executed. |
Mutiny.Query<R> | setCacheRegion(String cacheRegion) Set the name of the cache region in which to store this query result set if caching is enabled . |
Mutiny.Query<R> | setComment(String comment) Set the comment for this query. |
Mutiny.Query<R> | setFirstResult(int firstResult) Set the position of the first result that may be returned by this query when executed, where the results are numbered from 0. |
Mutiny.Query<R> | setFlushMode(FlushMode flushMode) Set the current FlushMode in effect while this query is being executed. |
Mutiny.Query<R> | setLockMode(LockMode lockMode) Set the LockMode to use for the whole query. |
Mutiny.Query<R> | setLockMode(String alias, LockMode lockMode) Set the LockMode to use for specified alias (as defined in the query's from clause). |
Mutiny.Query<R> | setMaxResults(int maxResults) Set the maximum number of results that may be returned by this query when executed. |
<T> Mutiny.Query<R> | setParameter(<any> name, T value) Set the value of a typed parameter. |
Mutiny.Query<R> | setParameter(int position, Object value) Set the value of a positional parameter. |
Mutiny.Query<R> | setParameter(String name, Object value) Set the value of a named parameter. |
Mutiny.Query<R> | setReadOnly(boolean readOnly) Set the read-only/modifiable mode for entities and proxies loaded by this Query. |
Mutiny.Query<R> setParameter(int position, Object value)
?1
, ?2
, etc.Mutiny.Query<R> setParameter(String name, Object value)
:name
.<T> Mutiny.Query<R> setParameter(<any> name, T value)
CriteriaBuilder
, which may itself be obtained by calling Mutiny.SessionFactory.getCriteriaBuilder()
.CriteriaBuilder#parameter(Class)
Mutiny.Query<R> setMaxResults(int maxResults)
Mutiny.Query<R> setFirstResult(int firstResult)
int getMaxResults()
Integer.MAX_VALUE
if not setint getFirstResult()
<any> getSingleResult()
null
if the query returns no results, throwing an exception if the query returns more than one matching row. If the query has multiple results per row, the results are returned in an instance of Object[]
.null
javax.persistence.Query#getSingleResult()
<any> getResultList()
List
, via a Uni
. If the query has multiple results per row, the results are returned in an instance of Object[]
. If the query has multiple results per row, the results are returned in an instance of Object[]
.List
javax.persistence.Query#getResultList()
default <any> getResults()
Multi
. If the query has multiple results per row, the results are returned in an instance of Object[]
. For now, this operation does no more than simply repackage the result of getResultList()
as a Multi
for convenience.
Multi
<any> executeUpdate()
javax.persistence.Query#executeUpdate()
Mutiny.Query<R> setReadOnly(boolean readOnly)
boolean isReadOnly()
Mutiny.Session.isDefaultReadOnly()
Mutiny.Query<R> setComment(String comment)
comment
- The human-readable commentMutiny.Query<R> setCacheable(boolean cacheable)
cacheable
- true
if this query is cacheableboolean isCacheable()
true
if this query is cacheablesetCacheable(boolean)
Mutiny.Query<R> setCacheRegion(String cacheRegion)
caching is enabled
.cacheRegion
- the name of the cache regionString getCacheRegion()
setCacheRegion(String)
Mutiny.Query<R> setCacheMode(CacheMode cacheMode)
CacheMode
in effect while this query is being executed.CacheMode getCacheMode()
CacheMode
in effect for this query. By default, the query inherits the CacheMode
of the Mutiny.Session
from which is originates.Mutiny.Session.getCacheMode()
Mutiny.Query<R> setFlushMode(FlushMode flushMode)
FlushMode
in effect while this query is being executed.FlushMode getFlushMode()
FlushMode
in effect for this query. By default, the query inherits the FlushMode
of the Mutiny.Session
from which is originates.Mutiny.Session.getFlushMode()
Mutiny.Query<R> setLockMode(LockMode lockMode)
LockMode
to use for the whole query.Mutiny.Query<R> setLockMode(String alias, LockMode lockMode)
LockMode
to use for specified alias (as defined in the query's from
clause).alias
- the from clause aliaslockMode
- the requested LockMode
org.hibernate.query.Query#setLockMode(String,LockMode)