Interface Mutiny.SelectionQuery<R>

All Superinterfaces:
Mutiny.AbstractQuery
All Known Subinterfaces:
Mutiny.Query<R>
Enclosing interface:
Mutiny

public static interface Mutiny.SelectionQuery<R> extends Mutiny.AbstractQuery
  • Method Details

    • setMaxResults

      Mutiny.SelectionQuery<R> setMaxResults(int maxResults)
      Set the maximum number of results that may be returned by this query when executed.
    • setFirstResult

      Mutiny.SelectionQuery<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.
    • setPage

      Set the page of results to return.
      Since:
      2.1
      See Also:
    • getMaxResults

      int getMaxResults()
      Returns:
      the maximum number results, or Integer.MAX_VALUE if not set
    • getFirstResult

      int getFirstResult()
      Returns:
      the first result, or 0 if not set
    • getSingleResult

      io.smallrye.mutiny.Uni<R> getSingleResult()
      Asynchronously execute this query, returning a single row that matches the query, throwing an exception if the query returns zero rows or more than one matching row. If the query has multiple results per row, the results are returned in an instance of Object[].
      Returns:
      the single resulting row
      Throws:
      jakarta.persistence.NoResultException - if there is no result
      jakarta.persistence.NonUniqueResultException - if there are multiple results
      See Also:
      • Query.getSingleResult()
    • getSingleResultOrNull

      io.smallrye.mutiny.Uni<R> getSingleResultOrNull()
      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. If the query has multiple results per row, the results are returned in an instance of Object[].
      Returns:
      the single resulting row or null
      Throws:
      jakarta.persistence.NonUniqueResultException - if there are multiple results
      See Also:
    • getResultCount

      @Incubating io.smallrye.mutiny.Uni<Long> getResultCount()
      Determine the size of the query result list that would be returned by calling getResultList() with no offset or limit applied to the query.
      Returns:
      the size of the list that would be returned
    • getResultList

      io.smallrye.mutiny.Uni<List<R>> getResultList()
      Asynchronously execute this query, returning the query results as a List, via a Uni. If the query has multiple results per row, the results are returned in an instance of Object[].
      Returns:
      the resulting rows as a List
      See Also:
      • Query.getResultList()
    • setReadOnly

      Mutiny.SelectionQuery<R> setReadOnly(boolean readOnly)
      Set the read-only/modifiable mode for entities and proxies loaded by this Query. This setting overrides the default setting for the persistence context.
      See Also:
    • isReadOnly

      boolean isReadOnly()
      Returns:
      the read-only/modifiable mode
      See Also:
    • setCacheable

      Mutiny.SelectionQuery<R> setCacheable(boolean cacheable)
      Enable or disable caching of this query result set in the second-level query cache.
      Parameters:
      cacheable - true if this query is cacheable
    • isCacheable

      boolean isCacheable()
      Returns:
      true if this query is cacheable
      See Also:
    • setCacheRegion

      Mutiny.SelectionQuery<R> setCacheRegion(String cacheRegion)
      Set the name of the cache region in which to store this query result set if caching is enabled.
      Parameters:
      cacheRegion - the name of the cache region
    • getCacheRegion

      String getCacheRegion()
      Returns:
      the name of the cache region
      See Also:
    • setCacheMode

      Mutiny.SelectionQuery<R> setCacheMode(CacheMode cacheMode)
      Set the current CacheMode in effect while this query is being executed.
    • setCacheStoreMode

      default Mutiny.SelectionQuery<R> setCacheStoreMode(jakarta.persistence.CacheStoreMode cacheStoreMode)
      Set the current CacheStoreMode in effect while this query is being executed.
    • setCacheRetrieveMode

      default Mutiny.SelectionQuery<R> setCacheRetrieveMode(jakarta.persistence.CacheRetrieveMode cacheRetrieveMode)
      Set the current CacheRetrieveMode in effect while this query is being executed.
    • getCacheStoreMode

      jakarta.persistence.CacheStoreMode getCacheStoreMode()
    • getCacheRetrieveMode

      jakarta.persistence.CacheRetrieveMode getCacheRetrieveMode()
    • getCacheMode

      CacheMode getCacheMode()
      Obtain the CacheMode in effect for this query. By default, the query inherits the CacheMode of the Mutiny.Session from which is originates.
      See Also:
    • setFlushMode

      Mutiny.SelectionQuery<R> setFlushMode(FlushMode flushMode)
      Set the current FlushMode in effect while this query is being executed.
    • setFlushMode

      default Mutiny.SelectionQuery<R> setFlushMode(jakarta.persistence.FlushModeType flushModeType)
      Set the current FlushModeType in effect while this query is being executed.
    • getFlushMode

      FlushMode getFlushMode()
      Obtain the FlushMode in effect for this query. By default, the query inherits the FlushMode of the Mutiny.Session from which is originates.
      See Also:
    • setLockMode

      Mutiny.SelectionQuery<R> setLockMode(LockMode lockMode)
      Set the LockMode to use for the whole query.
    • setLockMode

      default Mutiny.SelectionQuery<R> setLockMode(jakarta.persistence.LockModeType lockModeType)
      Set the LockModeType to use for the whole query.
    • setLockMode

      Mutiny.SelectionQuery<R> setLockMode(String alias, LockMode lockMode)
      Set the LockMode to use for specified alias (as defined in the query's from clause).
      Parameters:
      alias - the from clause alias
      lockMode - the requested LockMode
      See Also:
    • setLockMode

      default Mutiny.SelectionQuery<R> setLockMode(String alias, jakarta.persistence.LockModeType lockModeType)
      Set the LockModeType to use for specified alias (as defined in the query's from clause).
      Parameters:
      alias - the from clause alias
      lockModeType - the requested LockModeType
      See Also:
    • setOrder

      Mutiny.SelectionQuery<R> setOrder(List<Order<? super R>> orderList)
      If the result type of this query is an entity class, add one or more rules for ordering the query results.
      Parameters:
      orderList - one or more instances of Order
      See Also:
    • setOrder

      Mutiny.SelectionQuery<R> setOrder(Order<? super R> order)
      If the result type of this query is an entity class, add a rule for ordering the query results.
      Parameters:
      order - an instance of Order
      See Also:
    • setPlan

      Mutiny.SelectionQuery<R> setPlan(jakarta.persistence.EntityGraph<R> entityGraph)
      Set the EntityGraph that will be used as a fetch plan for the root entity returned by this query.
    • enableFetchProfile

      Mutiny.SelectionQuery<R> enableFetchProfile(String profileName)
      Enable a fetch profile which will be in effect during execution of this query.
    • setParameter

      Mutiny.SelectionQuery<R> setParameter(int parameter, Object argument)
      Description copied from interface: Mutiny.AbstractQuery
      Set the value of an ordinal parameter. Ordinal parameters are numbered from 1, and are specified in the query using placeholder tokens of form ?1, ?2, etc.
      Specified by:
      setParameter in interface Mutiny.AbstractQuery
      Parameters:
      parameter - an integer identifying the ordinal parameter
      argument - the argument to set
    • setParameter

      Mutiny.SelectionQuery<R> setParameter(String parameter, Object argument)
      Description copied from interface: Mutiny.AbstractQuery
      Set the value of a named parameter. Named parameters are specified in the query using placeholder tokens of form :name.
      Specified by:
      setParameter in interface Mutiny.AbstractQuery
      Parameters:
      parameter - the name of the parameter
      argument - the argument to set
    • setParameter

      <T> Mutiny.SelectionQuery<R> setParameter(jakarta.persistence.Parameter<T> parameter, T argument)
      Description copied from interface: Mutiny.AbstractQuery
      Set the value of a typed parameter. Typed parameters are obtained from the JPA CriteriaBuilder, which may itself be obtained by calling Mutiny.SessionFactory.getCriteriaBuilder().
      Specified by:
      setParameter in interface Mutiny.AbstractQuery
      Parameters:
      parameter - the parameter
      argument - the argument to set
      See Also:
      • CriteriaBuilder.parameter(Class)
    • setComment

      Mutiny.SelectionQuery<R> setComment(String comment)
      Description copied from interface: Mutiny.AbstractQuery
      Set the comment for this query. This comment will be prepended to the SQL query sent to the database.
      Specified by:
      setComment in interface Mutiny.AbstractQuery
      Parameters:
      comment - The human-readable comment