Interface QueryOptions

All Known Subinterfaces:
MutableQueryOptions
All Known Implementing Classes:
DelegatingQueryOptions, QueryOptionsAdapter

public interface QueryOptions
Encapsulates options for the execution of a query.
API Note:
Note that not all options are relevant for every type of query.
  • Field Details

    • NONE

      static final QueryOptions NONE
      Provide singleton access for a frequently needed option.
    • READ_WRITE

      static final QueryOptions READ_WRITE
    • READ_ONLY

      static final QueryOptions READ_ONLY
  • Method Details

    • getTimeout

      @Nullable Timeout getTimeout()
      The query execution timeout. May alternatively be specified at the transaction level using Transaction.getTimeout().
    • getQueryFlushMode

      @Nonnull QueryFlushMode getQueryFlushMode()
      The flush mode to use for the query execution.
    • isReadOnly

      @Nullable Boolean isReadOnly()
      Are entities returned by the query marked as read-only?
    • getAppliedGraph

      @Nullable AppliedGraph getAppliedGraph()
      An EntityGraph explicitly applied to the query.
    • getTupleTransformer

      @Nullable TupleTransformer<?> getTupleTransformer()
      Transformer applied to the query to transform the structure of each "row" of the results.
    • getResultListTransformer

      @Nullable ResultListTransformer<?> getResultListTransformer()
      Transformer applied to the query to transform the structure of the overall result list.
    • isResultCachingEnabled

      @Nullable Boolean isResultCachingEnabled()
      Should results from the query be cached?
      See Also:
    • getCacheRetrieveMode

      @Nullable CacheRetrieveMode getCacheRetrieveMode()
      Controls whether query results are read from the cache. Has no effect unless isResultCachingEnabled() returns true
      See Also:
    • getCacheStoreMode

      @Nullable CacheStoreMode getCacheStoreMode()
      Controls whether query results are put into the cache. Has no effect unless isResultCachingEnabled() returns true.
      See Also:
    • getCacheMode

      @Nullable default CacheMode getCacheMode()
    • getResultCacheRegionName

      @Nullable String getResultCacheRegionName()
      The query cache region in which the results should be cached. Has no effect unless isResultCachingEnabled() returns true.
    • getQueryPlanCachingEnabled

      @Nullable Boolean getQueryPlanCachingEnabled()
      Should the query plan of the query be cached?
    • isLimitInMemoryEnabled

      @Nullable default Boolean isLimitInMemoryEnabled()
      Whether top-level HQL/criteria pagination should be handled in memory instead of by the SQL query.
    • getEnabledFetchProfiles

      @Nullable Set<String> getEnabledFetchProfiles()
      The explicitly enabled profiles for this query.
    • getDisabledFetchProfiles

      @Nullable Set<String> getDisabledFetchProfiles()
      The explicitly disabled profiles for this query.
    • getLockOptions

      @Nonnull LockOptions getLockOptions()
      Describes the locking to apply to the query results.
    • getComment

      @Nullable String getComment()
      The SQL comment to apply to the interpreted SQL query, for dialects which support SQL comments.
    • getDatabaseHints

      @Nonnull List<String> getDatabaseHints()
      Hints to apply to the interpreted SQL query.
    • getFetchSize

      @Nullable Integer getFetchSize()
      The fetch size to be applied to the JDBC query.
      See Also:
    • getLimit

      @Nonnull Limit getLimit()
      The limit to the query results. May also be accessed via getFirstRow() and getMaxRows().
    • peekOriginalLimit

      @Nonnull default Limit peekOriginalLimit()
      The original Limit as set by the application, before any wrapper (SqlOmittingQueryOptions or the scroll execution context) hid it from getLimit(). Used by runtime parameter binders that the SQM-to-SQL converter pushed into the SQL AST so they can bind the original value even when getLimit() has been intentionally suppressed for SQL rendering.
    • getFirstRow

      @Nullable default Integer getFirstRow()
      The first row from the results to return.
      See Also:
    • getMaxRows

      @Nullable default Integer getMaxRows()
      The maximum number of rows to return from the results.
      See Also:
    • getEffectiveLimit

      @Nonnull default Limit getEffectiveLimit()
      Determine the effective paging limit to apply to the query. If the application did not explicitly specify paging limits, Limit.NONE is returned.
      See Also:
    • hasLimit

      default boolean hasLimit()
      Did the application explicitly request paging limits?
      See Also:
    • getUniqueSemantic

      @Nullable default ListResultsConsumer.UniqueSemantic getUniqueSemantic()
    • isScrollExecution

      default boolean isScrollExecution()
      Whether this execution goes through scroll() / getResultStream() and therefore needs SQL row ordering stable enough for scroll-style result grouping.