Interface Query<R>

Type Parameters:
R - The result type, for typed queries, orObject 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

@Incubatingpublic interfaceQuery<R>extendsSelectionQuery<R>,MutationQuery,TypedQuery<R>
Within the context of an activesession,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
  • acriteria query.

The subtypeNativeQuery represents a query written in native SQL.

This type simply mixes theTypedQuery interface defined by JPA withSelectionQuery andMutationQuery. Unfortunately, JPA doesnot distinguish betweenselection queries andmutation queries, so we lose that distinction here.However, everyQuery may logically be classified as one or the other.

AQuery may be obtained from theSession bycalling:

AQuery controls how a query is executed, and allows arguments to bebound to its parameters.

Note that this interface offers no real advantages overSelectionQueryexcept for compatibility with the JPA-definedTypedQuery interface.

See Also: