Package org.hibernate.query

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,NativeQueryImpl,ProcedureCallImpl,QuerySqmImpl

@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 does not 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 by calling:

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

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

See Also: