Package org.hibernate.query

Interface CommonQueryContract

All Known Subinterfaces:
MutationQuery,NativeQuery<T>,NativeQueryImplementor<R>,ProcedureCall,ProcedureCallImplementor<R>,Query<R>,QueryImplementor<R>,SelectionQuery<R>,SqmQuery,SqmQueryImplementor<R>,SqmSelectionQuery<R>,SqmSelectionQueryImplementor<R>
All Known Implementing Classes:
AbstractCommonQueryContract,AbstractQuery,AbstractSelectionQuery,DelegatingSqmSelectionQueryImplementor,NativeQueryImpl,ProcedureCallImpl,QuerySqmImpl,SqmSelectionQueryImpl

public interfaceCommonQueryContract
Defines the aspects of query execution and parameter binding that apply to all forms of querying:

Queries may haveparameters, either ordinal or named, and the varioussetParameter() operations of this interface allow an argument to be bound to a parameter. It's not usually necessary to explicitly specify the type of an argument, but in rare cases where this is needed:

For example:

 session.createSelectionQuery("from Person where address = :address", Person.class)         .setParameter("address", address, Person_.address.getType())         .getResultList()
 entityManager.createQuery( "from Person where address = :address", Person.class)         .setParameter("address", TypedParameterValue.of(Person_.address.getType(), address))         .getResultList()

The operationsetQueryFlushMode(QueryFlushMode) allows a temporary flush mode to be specified, which is in effect only during the execution of this query. Setting thequery flush mode does not affect the flush mode of other operations performed via the parentsession. This operation is usually used as follows:

query.setQueryFlushMode(NO_FLUSH).getResultList()

The call tosetQueryFlushMode(NO_FLUSH) disables the usual automatic flush operation that occurs before query execution.

See Also: