Top Description Fields Methods
org.hibernate.query.spi

public Interface QueryOptions

Known Direct Subinterfaces
org.hibernate.query.spi.MutableQueryOptions
Known Direct Implementers
org.hibernate.query.spi.QueryOptionsAdapter, org.hibernate.engine.jdbc.mutation.internal.MutationQueryOptions, org.hibernate.loader.ast.internal.LoaderSqlAstCreationState, org.hibernate.query.spi.DelegatingQueryOptions
Imports
java.sql.Statement, java.util.List, .Set, jakarta.persistence.CacheRetrieveMode, .CacheStoreMode, org.hibernate.CacheMode, .FlushMode, .LockOptions, org.hibernate.graph.spi.AppliedGraph, org.hibernate.query.ResultListTransformer, .TupleTransformer, org.hibernate.sql.results.spi.ListResultsConsumer

Encapsulates options for the execution of a HQL/Criteria/native query
Author
Steve Ebersole

Field Summary

Modifier and TypeField and Description
public static final QueryOptions
NONE

Provide singleton access for frequently needed options:

public static final QueryOptions
public static final QueryOptions

Method Summary

Modifier and TypeMethod and Description
public AppliedGraph
getAppliedGraph()

JPA jakarta.persistence.EntityGraph explicitly applied to the query.

public default CacheMode
public CacheRetrieveMode
getCacheRetrieveMode()

Controls whether query results are read from the cache.

public CacheStoreMode
getCacheStoreMode()

Controls whether query results are put into the cache.

public String
getComment()

The SQL comment to apply to the interpreted SQL query, for dialects which support SQL comments

public List<String>
getDatabaseHints()

Hints to apply to the interpreted SQL query

public Set<String>
getDisabledFetchProfiles()

The explicitly disabled profiles for this query

public default Limit
getEffectiveLimit()

Determine the effective paging limit to apply to the query.

public Set<String>
getEnabledFetchProfiles()

The explicitly enabled profiles for this query

public Integer
getFetchSize()

The fetch size to be applied to the JDBC query.

public default Integer
getFirstRow()

The first row from the results to return

public FlushMode
getFlushMode()

The flush mode to use for the query execution

public Limit
getLimit()

The limit to the query results.

public LockOptions
getLockOptions()

Describes the locking to apply to the query results

public default Integer
getMaxRows()

The maximum number of rows to return from the results

public Boolean
getQueryPlanCachingEnabled()

Should the query plan of the query be cached?

public String
getResultCacheRegionName()

The query cache region in which the results should be cached.

public ResultListTransformer<?>
getResultListTransformer()

Transformer applied to the query to transform the structure of the overall results

public Integer
getTimeout()

The timeout to apply to the query.

public TupleTransformer<?>
getTupleTransformer()

Transformer applied to the query to transform the structure of each "row" in the results

public default ListResultsConsumer.UniqueSemantic
public default boolean
hasLimit()

Did the application explicitly request paging limits?

public Boolean
isReadOnly()

Should entities returned from the query be marked read-only.

public Boolean
isResultCachingEnabled()

Should results from the query be cached?

Field Detail

NONEback to summary
public static final QueryOptions NONE

Provide singleton access for frequently needed options:

READ_ONLYback to summary
public static final QueryOptions READ_ONLY
READ_WRITEback to summary
public static final QueryOptions READ_WRITE

Method Detail

getAppliedGraphback to summary
public AppliedGraph getAppliedGraph()

JPA jakarta.persistence.EntityGraph explicitly applied to the query.

getCacheModeback to summary
public default CacheMode getCacheMode()
getCacheRetrieveModeback to summary
public CacheRetrieveMode getCacheRetrieveMode()

Controls whether query results are read from the cache. No effect unless isResultCachingEnabled returns true

See Also
CacheMode
getCacheStoreModeback to summary
public CacheStoreMode getCacheStoreMode()

Controls whether query results are put into the cache. No effect unless isResultCachingEnabled returns true

See Also
CacheMode
getCommentback to summary
public String getComment()

The SQL comment to apply to the interpreted SQL query, for dialects which support SQL comments

getDatabaseHintsback to summary
public List<String> getDatabaseHints()

Hints to apply to the interpreted SQL query

getDisabledFetchProfilesback to summary
public Set<String> getDisabledFetchProfiles()

The explicitly disabled profiles for this query

getEffectiveLimitback to summary
public 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
getLimit
getEnabledFetchProfilesback to summary
public Set<String> getEnabledFetchProfiles()

The explicitly enabled profiles for this query

getFetchSizeback to summary
public Integer getFetchSize()

The fetch size to be applied to the JDBC query.

See Also
Statement#getFetchSize
getFirstRowback to summary
public default Integer getFirstRow()

The first row from the results to return

See Also
getLimit
getFlushModeback to summary
public FlushMode getFlushMode()

The flush mode to use for the query execution

getLimitback to summary
public Limit getLimit()

The limit to the query results. May also be accessed via getFirstRow and getMaxRows

getLockOptionsback to summary
public LockOptions getLockOptions()

Describes the locking to apply to the query results

getMaxRowsback to summary
public default Integer getMaxRows()

The maximum number of rows to return from the results

See Also
getLimit
getQueryPlanCachingEnabledback to summary
public Boolean getQueryPlanCachingEnabled()

Should the query plan of the query be cached?

getResultCacheRegionNameback to summary
public String getResultCacheRegionName()

The query cache region in which the results should be cached. No effect unless isResultCachingEnabled returns true

getResultListTransformerback to summary
public ResultListTransformer<?> getResultListTransformer()

Transformer applied to the query to transform the structure of the overall results

getTimeoutback to summary
public Integer getTimeout()

The timeout to apply to the query. May also be defined at the transaction level using org.hibernate.Transaction#getTimeout

getTupleTransformerback to summary
public TupleTransformer<?> getTupleTransformer()

Transformer applied to the query to transform the structure of each "row" in the results

getUniqueSemanticback to summary
public default ListResultsConsumer.UniqueSemantic getUniqueSemantic()
hasLimitback to summary
public default boolean hasLimit()

Did the application explicitly request paging limits?

See Also
getLimit
isReadOnlyback to summary
public Boolean isReadOnly()

Should entities returned from the query be marked read-only.

isResultCachingEnabledback to summary
public Boolean isResultCachingEnabled()

Should results from the query be cached?

See Also
getCacheMode, getResultCacheRegionName