Interface Query<R>

Type Parameters:
R - The result type, for typed queries, or Object for untyped queries
All Superinterfaces:
CommonQueryContract, MutationQuery, Query, SelectionQuery<R>, TypedQuery<R>
All Known Subinterfaces:
NativeQuery<T>, NativeQueryImplementor<R>, ProcedureCallImplementor<R>, QueryImplementor<R>, SqmQueryImplementor<R>
All Known Implementing Classes:
AbstractQuery, NativeQueryImpl, ProcedureCallImpl, QuerySqmImpl

@Incubating public interface Query<R> extends SelectionQuery<R>, MutationQuery, TypedQuery<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.

The subtype NativeQuery represents a query written in native SQL.

This type simply mixes the TypedQuery interface defined by JPA with SelectionQuery and MutationQuery. Unfortunately, JPA does not distinguish between selection queries and mutation queries, so we lose that distinction here. However, every Query may logically be classified as one or the other.

A Query may be obtained from the Session by calling:

A Query controls how a query is executed, and allows arguments to be bound to its parameters.

Note that this interface offers no real advantages over SelectionQuery except for compatibility with the JPA-defined TypedQuery interface.

See Also: