Package org.hibernate.query
Everything related to HQL/JPQL, native SQL, and criteria queries.
The important interfaces SelectionQuery
,
MutationQuery
, Query
,
and NativeQuery
provide an API for executing
queries. Instances of these interfaces may be obtained from a
QueryProducer
, that is, from any
Session
or StatelessSession
.
The classes Order
, Page
,
KeyedPage
, and KeyedResultList
define an API for dynamic ordering and key-based pagination. These
classes are especially useful as parameters of generated
@Find
and
@HQL
methods.
Hibernate's extensions to the JPA criteria query API are defined in the
subpackage org.hibernate.query.criteria
, with
HibernateCriteriaBuilder
as the
entry point.
Other subpackages contain SPIs and internal implementation details, including the HQL parser and translator.
-
Interface Summary Interface Description BindableType<J> Types that can be used to handle bindingQuery
parametersCommonQueryContract Defines the aspects of query execution and parameter binding that apply to all forms of querying: HQL/JPQL queries, native SQL queries, criteria queries, and stored procedure calls.JpaTuple Hibernate extension to the Jakarta PersistenceTuple
contractMutationQuery Within the context of an active session, an instance of this type represents an executable mutation query, that is, aninsert
,update
, ordelete
.NativeQuery<T> Within the context of an active session, an instance of this type represents an executable query written in the native SQL dialect of the underlying database.NativeQuery.CollectionReturn Allows access to further control how collection returns are mapped back from result sets.NativeQuery.FetchReturn Allows access to further control how join fetch returns are mapped back from result sets.NativeQuery.InstantiationResultNode<J> NativeQuery.ResultNode Simple unification interface for all returns from the variousaddXYZ()
methods.NativeQuery.ReturnableResultNode ANativeQuery.ResultNode
which can be a query result.NativeQuery.ReturnProperty Allows access to further control how properties within a root or join fetch are mapped back from the result set.NativeQuery.RootReturn Allows access to further control how root returns are mapped back from result sets.OutputableType<J> Specialization ofDomainType
for types that can be used as a parameter output for aProcedureCall
.ParameterMetadata Access to known information about the parameters for a query.Query<R> Within the context of an active session, an instance of this type represents an executable query, either: a query written in HQL, a named query written in HQL or native SQL, or a criteria query.QueryLogging QueryParameter<T> Represents a parameter defined in the source (HQL/JPQL or criteria) query.QueryProducer Contract for things that can produce instances ofQuery
andNativeQuery
.ResultListTransformer<T> ReturnableType<T> Specialization of DomainType for types that can be used as function returnsSelectionQuery<R> Within the context of an active session, an instance of this type represents an executable selection query, that is, aselect
.SynchronizeableQuery Represents the abstract notion of a query whose results are affected by the data stored in a given set of named query spaces.TupleTransformer<T> TypedTupleTransformer<T> Extension to TupleTransformer exposing the transformation target type. -
Class Summary Class Description KeyedPage<R> Support for pagination based on a unique key of the result set instead of theoffset
.KeyedResultList<R> Support for pagination based on a unique key of the result set instead of theoffset
.Order<X> A rule for sorting a query result set.Page Identifies a page of query results by page size and page number.TypedParameterValue<J> Represents a typed argument to a query parameter. -
Enum Summary Enum Description ImmutableEntityUpdateQueryHandlingMode This enum defines howImmutable
entities are handled when executing a bulk update statement.KeyedPage.KeyInterpretation NullPrecedence Enumerates the possibilities for the precedence of null values within query result sets sorted by anORDER BY
clause.SortDirection Enumerates the directions in which query results may be sorted. -
Exception Summary Exception Description IllegalMutationQueryException Indicates an attempt to callQueryProducer.createMutationQuery(String)
,QueryProducer.createNamedMutationQuery(String)
orQueryProducer.createNativeMutationQuery(String)
with a non-mutation query (generally a select query)IllegalNamedQueryOptionsException Indicates a named-query has specified options that are not legalIllegalQueryOperationException Thrown when an operation of theQuery
interface is called which is unsupported due to the nature of the query itself.IllegalSelectQueryException Indicates an attempt to callQueryProducer.createSelectionQuery(String)
with a non-selection query (generally a mutation query)NamedQueryValidationException Indicates that validation and translation of one or more named queries failed at initialization time.NotIndexedCollectionException Indicates an attempt to use a non-indexed collection as indexed.ParameterLabelException Indicates a problem with the labelling of query parameters.PathException Indicates a problem with a path expression in HQL/JPQL.QueryArgumentException An error that occurs binding an argument to a query parameter.QueryTypeMismatchException Indicates a mismatch between the expected and actual result types of a query.SemanticException Represents an error in the semantics (meaning) of a HQL/JPQL query.SyntaxException Represents a syntax error in a HQL/JPQL query.UnknownNamedQueryException Occurs when a named query is requested, and there is no known HQL or native SQL query registered under the given name.UnknownParameterException Indicates an attempt to find an unknown query parameter or an attempt to bind a value to an unknown query parameterUnknownSqlResultSetMappingException Indicates a request for named ResultSet mapping which could not be found