Package org.hibernate.query
Interface Query<R>
-
- Type Parameters:
R
- The query result type (for typed queries)
- All Superinterfaces:
CommonQueryContract
,Query
,TypedQuery<R>
- All Known Subinterfaces:
HqlQueryImplementor<R>
,NativeQuery<T>
,NativeQueryImplementor<R>
,ProcedureCallImplementor<R>
,QueryImplementor<R>
- All Known Implementing Classes:
AbstractQuery
public interface Query<R> extends TypedQuery<R>, CommonQueryContract
Represents an HQL/JPQL query or a compiled Criteria query. Also acts as the Hibernate extension to the JPA Query/TypedQuery contract
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description Query<R>
addQueryHint(String hint)
Add a DB query hint to the SQL.default Query<R>
applyFetchGraph(RootGraph graph)
Apply the given graph using fetch semanticsQuery<R>
applyGraph(RootGraph<?> graph, GraphSemantic semantic)
Apply the given graph using the given semanticdefault Query<R>
applyLoadGraph(RootGraph graph)
Apply the given graph using load semanticsString
getComment()
Obtain the comment currently associated with this query.LockOptions
getLockOptions()
Obtains the LockOptions in effect for this query.ParameterMetadata
getParameterMetadata()
Access to information about query parameters.QueryOptions
getQueryOptions()
Get the execution options for this Query.String
getQueryString()
Get the query string.default List<R>
getResultList()
default Stream<R>
getResultStream()
SharedSessionContract
getSession()
Get the QueryProducer this Query originates from.default R
getSingleResult()
List<R>
list()
Return the query results as a List.ScrollableResults<R>
scroll()
Returns scrollable access to the query results.ScrollableResults<R>
scroll(ScrollMode scrollMode)
Returns scrollable access to the query results.Query<R>
setCacheable(boolean cacheable)
Enable/disable second level query (result) caching for this query.Query<R>
setCacheMode(CacheMode cacheMode)
(Re)set the current CacheMode in effect for this query.Query<R>
setCacheRegion(String cacheRegion)
Set the name of the cache region where query results should be cached (if cached at all).Query<R>
setComment(String comment)
Set the comment for this query.Query<R>
setFetchSize(int fetchSize)
Sets a JDBC fetch size hint for the query.Query<R>
setFirstResult(int startPosition)
Query<R>
setFlushMode(FlushModeType flushMode)
Query<R>
setHibernateFlushMode(FlushMode flushMode)
(Re)set the current FlushMode in effect for this query.Query<R>
setHint(String hintName, Object value)
Query<R>
setLockMode(LockModeType lockMode)
Query<R>
setLockMode(String alias, LockMode lockMode)
Set the LockMode to use for specific alias (as defined in the query's FROM clause).Query<R>
setLockOptions(LockOptions lockOptions)
Set the lock options for the query.Query<R>
setMaxResults(int maxResult)
Query<R>
setParameter(int position, Object value)
Bind a positional query parameter using its inferred Type.Query<R>
setParameter(int position, Instant value, TemporalType temporalType)
Query<R>
setParameter(int position, LocalDateTime value, TemporalType temporalType)
Query<R>
setParameter(int position, OffsetDateTime value, TemporalType temporalType)
Query<R>
setParameter(int position, ZonedDateTime value, TemporalType temporalType)
Query<R>
setParameter(int position, Calendar value, TemporalType temporalType)
Query<R>
setParameter(int position, Date value, TemporalType temporalType)
<P> Query<R>
setParameter(int position, P val, TemporalType temporalType)
Bind a positional query parameter as some form of date/time using the indicated temporal-type.<P> Query<R>
setParameter(int position, P val, AllowableParameterType<P> type)
Bind a value to a JDBC-style query parameter.<P> Query<R>
setParameter(int position, P val, BasicTypeReference<P> type)
Bind a value to a JDBC-style query parameter.Query<R>
setParameter(Parameter<Instant> param, Instant value, TemporalType temporalType)
Query<R>
setParameter(Parameter<LocalDateTime> param, LocalDateTime value, TemporalType temporalType)
Query<R>
setParameter(Parameter<OffsetDateTime> param, OffsetDateTime value, TemporalType temporalType)
Query<R>
setParameter(Parameter<ZonedDateTime> param, ZonedDateTime value, TemporalType temporalType)
Query<R>
setParameter(Parameter<Calendar> param, Calendar value, TemporalType temporalType)
Query<R>
setParameter(Parameter<Date> param, Date value, TemporalType temporalType)
<T> Query<R>
setParameter(Parameter<T> param, T value)
Query<R>
setParameter(String name, Object value)
Bind a named query parameter using its inferred Type.Query<R>
setParameter(String name, Instant value, TemporalType temporalType)
Query<R>
setParameter(String name, LocalDateTime value, TemporalType temporalType)
Query<R>
setParameter(String name, OffsetDateTime value, TemporalType temporalType)
Query<R>
setParameter(String name, ZonedDateTime value, TemporalType temporalType)
Query<R>
setParameter(String name, Calendar value, TemporalType temporalType)
Query<R>
setParameter(String name, Date value, TemporalType temporalType)
<P> Query<R>
setParameter(String name, P val, TemporalType temporalType)
Bind a named query parameter as some form of date/time using the indicated temporal-type.<P> Query<R>
setParameter(String name, P val, AllowableParameterType<P> type)
Bind a named query parameter using the supplied Type<P> Query<R>
setParameter(String name, P val, BasicTypeReference<P> type)
Bind a named query parameter using the supplied Type<P> Query<R>
setParameter(QueryParameter<P> parameter, P val, TemporalType temporalType)
Bind a query parameter as some form of date/time using the indicated temporal-type.<P> Query<R>
setParameter(QueryParameter<P> parameter, P val, AllowableParameterType<P> type)
Bind a query parameter using the supplied Type<P> Query<R>
setParameter(QueryParameter<P> parameter, P val, BasicTypeReference<P> type)
Bind a query parameter using the supplied Type<T> Query<R>
setParameter(QueryParameter<T> parameter, T val)
Bind a query parameter using its inferred Type.Query<R>
setParameterList(int position, Object[] values)
Bind multiple values to a named query parameter.Query<R>
setParameterList(int position, Object[] values, AllowableParameterType<?> type)
Bind multiple values to a named query parameter.Query<R>
setParameterList(int position, Collection<?> values)
Bind multiple values to a positional query parameter.<P> Query<R>
setParameterList(int position, Collection<? extends P> values, Class<P> type)
Bind multiple values to a positional query parameter.<P> Query<R>
setParameterList(int position, Collection<? extends P> values, AllowableParameterType<P> type)
Bind multiple values to a positional query parameter.Query<R>
setParameterList(String name, Object[] values)
Bind multiple values to a named query parameter.Query<R>
setParameterList(String name, Object[] values, AllowableParameterType<?> type)
Bind multiple values to a named query parameter.Query<R>
setParameterList(String name, Collection<?> values)
Bind multiple values to a named query parameter.<P> Query<R>
setParameterList(String name, Collection<? extends P> values, Class<P> type)
Bind multiple values to a named query parameter.<P> Query<R>
setParameterList(String name, Collection<? extends P> values, AllowableParameterType<P> type)
Bind multiple values to a named query parameter.<P> Query<R>
setParameterList(QueryParameter<P> parameter, Collection<P> values)
Bind multiple values to a query parameter using its inferred Type.Query<R>
setProperties(Object bean)
Bind the property values of the given bean to named parameters of the query, matching property names with parameter names and mapping property types to Hibernate types using heuristics.Query<R>
setProperties(Map bean)
Bind the values of the given Map for each named parameters of the query, matching key names with parameter names and mapping value types to Hibernate types using heuristics.Query<R>
setReadOnly(boolean readOnly)
Set the read-only/modifiable mode for entities and proxies loaded by this Query.Query<R>
setResultListTransformer(ResultListTransformer transformer)
default Query<R>
setResultTransformer(ResultTransformer transformer)
Deprecated.Query<R>
setTimeout(int timeout)
Set the query timeout in seconds.Query<R>
setTupleTransformer(TupleTransformer<R> transformer)
Stream<R>
stream()
Retrieve a Stream over the query results.R
uniqueResult()
Convenience method to return a single instance that matches the query, ornull
if the query returns no results.Optional<R>
uniqueResultOptional()
-
Methods inherited from interface org.hibernate.query.CommonQueryContract
getCacheMode, getCacheRegion, getFetchSize, getHibernateFlushMode, getTimeout, isCacheable, isReadOnly
-
Methods inherited from interface jakarta.persistence.Query
executeUpdate, getFirstResult, getFlushMode, getHints, getLockMode, getMaxResults, getParameter, getParameter, getParameter, getParameter, getParameters, getParameterValue, getParameterValue, getParameterValue, isBound, unwrap
-
-
-
-
Method Detail
-
getSession
SharedSessionContract getSession()
Get the QueryProducer this Query originates from. Generally speaking, this is the Session/StatelessSession that was used to create the Query instance.- Returns:
- The producer of this query
-
getQueryString
String getQueryString()
Get the query string. Note that this may benull
or some other less-than-useful return because the source of the query might not be a String (e.g., a Criteria query).- Returns:
- the query string.
-
applyGraph
Query<R> applyGraph(RootGraph<?> graph, GraphSemantic semantic)
Apply the given graph using the given semantic- Parameters:
graph
- The graph the apply.semantic
- The semantic to use when applying the graph- Returns:
- this - for method chaining
-
applyFetchGraph
default Query<R> applyFetchGraph(RootGraph graph)
Apply the given graph using fetch semantics- "API Note:"
- This method calls
applyGraph(RootGraph, GraphSemantic)
usingGraphSemantic.FETCH
as the semantic
-
applyLoadGraph
default Query<R> applyLoadGraph(RootGraph graph)
Apply the given graph using load semantics- "API Note:"
- This method calls
applyGraph(RootGraph, GraphSemantic)
usingGraphSemantic.LOAD
as the semantic
-
scroll
ScrollableResults<R> scroll()
Returns scrollable access to the query results. This form callsscroll(ScrollMode)
usingDialect.defaultScrollMode()
- "API Note:"
- The exact behavior of this method depends somewhat
on the JDBC driver's
ResultSet
scrolling support
-
scroll
ScrollableResults<R> scroll(ScrollMode scrollMode)
Returns scrollable access to the query results. The capabilities of the returned ScrollableResults depend on the specified ScrollMode.- "API Note:"
- The exact behavior of this method depends somewhat
on the JDBC driver's
ResultSet
scrolling support
-
list
List<R> list()
Return the query results as a List. If the query contains multiple results per row, the results are returned in an instance of Object[].- Returns:
- the result list
-
getResultList
default List<R> getResultList()
- Specified by:
getResultList
in interfaceQuery
- Specified by:
getResultList
in interfaceTypedQuery<R>
-
getResultStream
default Stream<R> getResultStream()
- Specified by:
getResultStream
in interfaceQuery
- Specified by:
getResultStream
in interfaceTypedQuery<R>
-
uniqueResult
R uniqueResult()
Convenience method to return a single instance that matches the query, ornull
if the query returns no results.- Returns:
- the single result or null
- Throws:
NonUniqueResultException
- if there is more than one matching result
-
getSingleResult
default R getSingleResult()
- Specified by:
getSingleResult
in interfaceQuery
- Specified by:
getSingleResult
in interfaceTypedQuery<R>
-
stream
Stream<R> stream()
Retrieve a Stream over the query results. In the initial implementation (5.2) this returns a simple sequential Stream. The plan is to return a a smarter stream in 6.x leveraging the SQM model.You should call
BaseStream.close()
after processing the stream so that the underlying resources are deallocated right away.- Returns:
- The results Stream
- Since:
- 5.2
-
getComment
String getComment()
Obtain the comment currently associated with this query. Provided SQL commenting is enabled (generally by enabling thehibernate.use_sql_comments
config setting), this comment will also be added to the SQL query sent to the database. Often useful for identifying the source of troublesome queries on the database side.- Returns:
- The comment.
-
setComment
Query<R> setComment(String comment)
Set the comment for this query.- Parameters:
comment
- The human-readable comment- Returns:
this
, for method chaining- See Also:
getComment()
-
addQueryHint
Query<R> addQueryHint(String hint)
Add a DB query hint to the SQL. These differ from JPA'sQueryHint
andQuery.getHints()
, which is specific to the JPA implementation and ignores DB vendor-specific hints. Instead, these are intended solely for the vendor-specific hints, such as Oracle's optimizers. Multiple query hints are supported; the Dialect will determine concatenation and placement.- Parameters:
hint
- The database specific query hint to add.
-
getLockOptions
LockOptions getLockOptions()
Obtains the LockOptions in effect for this query.- Returns:
- The LockOptions
- See Also:
LockOptions
-
setLockOptions
Query<R> setLockOptions(LockOptions lockOptions)
Set the lock options for the query. Specifically only the following are taken into consideration: For alias-specific locking, usesetLockMode(String, LockMode)
.- Parameters:
lockOptions
- The lock options to apply to the query.- Returns:
this
, for method chaining- See Also:
getLockOptions()
-
setLockMode
Query<R> setLockMode(String alias, LockMode lockMode)
Set the LockMode to use for specific alias (as defined in the query's FROM clause).The alias-specific lock modes specified here are added to the query's internal
LockOptions
.The effect of these alias-specific LockModes is somewhat dependent on the driver/database in use. Generally speaking, for maximum portability, this method should only be used to mark that the rows corresponding to the given alias should be included in pessimistic locking (
LockMode.PESSIMISTIC_WRITE
).- Parameters:
alias
- a query alias, or"this"
for a collection filterlockMode
- The lock mode to apply.- Returns:
this
, for method chaining- See Also:
getLockOptions()
-
setTupleTransformer
Query<R> setTupleTransformer(TupleTransformer<R> transformer)
-
setResultListTransformer
Query<R> setResultListTransformer(ResultListTransformer transformer)
-
getQueryOptions
QueryOptions getQueryOptions()
Get the execution options for this Query. Many of the setter on the Query contract update the state of the returnedQueryOptions
. This is important because it gives access to any primitive data in their wrapper forms rather than the primitive forms as required by JPA. For example, that allows use to know whether a specific value has been set at all by the Query consumer.- Returns:
- Return the encapsulation of this query's options, which includes access to firstRow, maxRows, timeout and fetchSize, etc.
-
getParameterMetadata
ParameterMetadata getParameterMetadata()
Access to information about query parameters.- Returns:
- information about query parameters.
-
setParameter
<T> Query<R> setParameter(QueryParameter<T> parameter, T val)
Bind a query parameter using its inferred Type. If the parameter is defined in such a way that the Type cannot be inferred from its usage context then use of this form of binding is not allowed, andsetParameter(QueryParameter, Object, AllowableParameterType)
should be used instead- Parameters:
parameter
- The query parameter mementoval
- the possibly-null parameter value- Returns:
this
, for method chaining
-
setParameter
<P> Query<R> setParameter(String name, P val, AllowableParameterType<P> type)
Bind a named query parameter using the supplied Type- Parameters:
name
- the name of the parameterval
- the possibly-null parameter valuetype
- the Hibernate allowable parameter type- Returns:
this
, for method chaining
-
setParameter
<P> Query<R> setParameter(int position, P val, AllowableParameterType<P> type)
Bind a value to a JDBC-style query parameter.- Parameters:
position
- the position of the parameter in the query string, numbered from 0.val
- the possibly-null parameter valuetype
- the Hibernate allowable parameter type- Returns:
this
, for method chaining
-
setParameter
<P> Query<R> setParameter(String name, P val, BasicTypeReference<P> type)
Bind a named query parameter using the supplied Type- Parameters:
name
- the name of the parameterval
- the possibly-null parameter valuetype
- the Hibernate allowable parameter type- Returns:
this
, for method chaining
-
setParameter
<P> Query<R> setParameter(int position, P val, BasicTypeReference<P> type)
Bind a value to a JDBC-style query parameter.- Parameters:
position
- the position of the parameter in the query string, numbered from 0.val
- the possibly-null parameter valuetype
- the Hibernate allowable parameter type- Returns:
this
, for method chaining
-
setParameter
<P> Query<R> setParameter(String name, P val, TemporalType temporalType)
Bind a named query parameter as some form of date/time using the indicated temporal-type.- Parameters:
name
- the parameter nameval
- the possibly-null parameter valuetemporalType
- the temporal-type to use in binding the date/time- Returns:
this
, for method chaining
-
setParameter
<P> Query<R> setParameter(int position, P val, TemporalType temporalType)
Bind a positional query parameter as some form of date/time using the indicated temporal-type.- Parameters:
position
- the position of the parameter in the query string, numbered from 0.val
- the possibly-null parameter valuetemporalType
- the temporal-type to use in binding the date/time- Returns:
this
, for method chaining
-
setParameter
<P> Query<R> setParameter(QueryParameter<P> parameter, P val, TemporalType temporalType)
Bind a query parameter as some form of date/time using the indicated temporal-type.- Parameters:
parameter
- The query parameter mementoval
- the possibly-null parameter valuetemporalType
- the temporal-type to use in binding the date/time- Returns:
this
, for method chaining
-
setParameter
<P> Query<R> setParameter(QueryParameter<P> parameter, P val, AllowableParameterType<P> type)
Bind a query parameter using the supplied Type- Parameters:
parameter
- The query parameter mementoval
- the possibly-null parameter valuetype
- the Hibernate allowable parameter type- Returns:
this
, for method chaining
-
setParameter
<P> Query<R> setParameter(QueryParameter<P> parameter, P val, BasicTypeReference<P> type)
Bind a query parameter using the supplied Type- Parameters:
parameter
- The query parameter mementoval
- the possibly-null parameter valuetype
- the Hibernate allowable parameter type- Returns:
this
, for method chaining
-
setParameter
Query<R> setParameter(Parameter<Instant> param, Instant value, TemporalType temporalType)
-
setParameter
Query<R> setParameter(Parameter<LocalDateTime> param, LocalDateTime value, TemporalType temporalType)
-
setParameter
Query<R> setParameter(Parameter<ZonedDateTime> param, ZonedDateTime value, TemporalType temporalType)
-
setParameter
Query<R> setParameter(Parameter<OffsetDateTime> param, OffsetDateTime value, TemporalType temporalType)
-
setParameter
Query<R> setParameter(String name, Instant value, TemporalType temporalType)
-
setParameter
Query<R> setParameter(String name, LocalDateTime value, TemporalType temporalType)
-
setParameter
Query<R> setParameter(String name, ZonedDateTime value, TemporalType temporalType)
-
setParameter
Query<R> setParameter(String name, OffsetDateTime value, TemporalType temporalType)
-
setParameter
Query<R> setParameter(int position, Instant value, TemporalType temporalType)
-
setParameter
Query<R> setParameter(int position, LocalDateTime value, TemporalType temporalType)
-
setParameter
Query<R> setParameter(int position, ZonedDateTime value, TemporalType temporalType)
-
setParameter
Query<R> setParameter(int position, OffsetDateTime value, TemporalType temporalType)
-
setHibernateFlushMode
Query<R> setHibernateFlushMode(FlushMode flushMode)
Description copied from interface:CommonQueryContract
(Re)set the current FlushMode in effect for this query.- Specified by:
setHibernateFlushMode
in interfaceCommonQueryContract
- Parameters:
flushMode
- The new FlushMode to use.- Returns:
this
, for method chaining- See Also:
Session.getHibernateFlushMode()
,CommonQueryContract.getHibernateFlushMode()
-
setCacheable
Query<R> setCacheable(boolean cacheable)
Description copied from interface:CommonQueryContract
Enable/disable second level query (result) caching for this query.- Specified by:
setCacheable
in interfaceCommonQueryContract
- Parameters:
cacheable
- Should the query results be cacheable?- Returns:
this
, for method chaining- See Also:
CommonQueryContract.isCacheable()
-
setCacheRegion
Query<R> setCacheRegion(String cacheRegion)
Description copied from interface:CommonQueryContract
Set the name of the cache region where query results should be cached (if cached at all).- Specified by:
setCacheRegion
in interfaceCommonQueryContract
- Parameters:
cacheRegion
- the name of a query cache region, ornull
to indicate that the default region should be used.- Returns:
this
, for method chaining- See Also:
CommonQueryContract.getCacheRegion()
-
setCacheMode
Query<R> setCacheMode(CacheMode cacheMode)
Description copied from interface:CommonQueryContract
(Re)set the current CacheMode in effect for this query.- Specified by:
setCacheMode
in interfaceCommonQueryContract
- Parameters:
cacheMode
- The new CacheMode to use.- Returns:
this
, for method chaining- See Also:
CommonQueryContract.getCacheMode()
-
setTimeout
Query<R> setTimeout(int timeout)
Description copied from interface:CommonQueryContract
Set the query timeout in seconds. NOTE it is important to understand that any value set here is eventually passed directly through to the JDBC Statement which expressly disallows negative values. So negative values should be avoided as a general rule.- Specified by:
setTimeout
in interfaceCommonQueryContract
- Parameters:
timeout
- the timeout in seconds- Returns:
this
, for method chaining- See Also:
CommonQueryContract.getTimeout()
-
setFetchSize
Query<R> setFetchSize(int fetchSize)
Description copied from interface:CommonQueryContract
Sets a JDBC fetch size hint for the query.- Specified by:
setFetchSize
in interfaceCommonQueryContract
- Parameters:
fetchSize
- the fetch size hint- Returns:
this
, for method chaining- See Also:
CommonQueryContract.getFetchSize()
-
setReadOnly
Query<R> setReadOnly(boolean readOnly)
Description copied from interface:CommonQueryContract
Set the read-only/modifiable mode for entities and proxies loaded by this Query. This setting overrides the default setting for the persistence context.- Specified by:
setReadOnly
in interfaceCommonQueryContract
- Parameters:
readOnly
-true
indicates that entities and proxies loaded by the query are to be put in read-only mode;false
indicates that entities and proxies loaded by the query will be put in modifiable mode- Returns:
this
, for method chaining- See Also:
To set the default read-only/modifiable setting used for entities and proxies that are loaded into the session:
,PersistenceContext.setDefaultReadOnly(boolean)
,Read-only entities are not dirty-checked and snapshots of persistent state are not maintained. Read-only entities can be modified, but changes are not persisted. When a proxy is initialized, the loaded entity will have the same read-only/modifiable setting as the uninitialized proxy has, regardless of the session's current setting. The read-only/modifiable setting has no impact on entities/proxies returned by the query that existed in the session beforeQuery the query was executed.
-
setMaxResults
Query<R> setMaxResults(int maxResult)
- Specified by:
setMaxResults
in interfaceQuery
- Specified by:
setMaxResults
in interfaceTypedQuery<R>
-
setFirstResult
Query<R> setFirstResult(int startPosition)
- Specified by:
setFirstResult
in interfaceQuery
- Specified by:
setFirstResult
in interfaceTypedQuery<R>
-
setHint
Query<R> setHint(String hintName, Object value)
- Specified by:
setHint
in interfaceQuery
- Specified by:
setHint
in interfaceTypedQuery<R>
-
setFlushMode
Query<R> setFlushMode(FlushModeType flushMode)
- Specified by:
setFlushMode
in interfaceQuery
- Specified by:
setFlushMode
in interfaceTypedQuery<R>
-
setLockMode
Query<R> setLockMode(LockModeType lockMode)
- Specified by:
setLockMode
in interfaceQuery
- Specified by:
setLockMode
in interfaceTypedQuery<R>
-
setParameter
Query<R> setParameter(String name, Object value)
Bind a named query parameter using its inferred Type. If the parameter is defined in such a way that the Type cannot be inferred from its usage context then use of this form of binding is not allowed, andsetParameter(String, Object, AllowableParameterType)
should be used instead- Specified by:
setParameter
in interfaceQuery
- Specified by:
setParameter
in interfaceTypedQuery<R>
- Parameters:
name
- the parameter namevalue
- the (possibly-null) parameter value- Returns:
this
, for method chaining
-
setParameter
Query<R> setParameter(int position, Object value)
Bind a positional query parameter using its inferred Type. If the parameter is defined in such a way that the Type cannot be inferred from its usage context then use of this form of binding is not allowed, andsetParameter(int, Object, AllowableParameterType)
should be used instead- Specified by:
setParameter
in interfaceQuery
- Specified by:
setParameter
in interfaceTypedQuery<R>
- Parameters:
position
- the position of the parameter in the query string, numbered from 0.value
- the possibly-null parameter value- Returns:
this
, for method chaining
-
setParameter
<T> Query<R> setParameter(Parameter<T> param, T value)
- Specified by:
setParameter
in interfaceQuery
- Specified by:
setParameter
in interfaceTypedQuery<R>
-
setParameter
Query<R> setParameter(Parameter<Calendar> param, Calendar value, TemporalType temporalType)
- Specified by:
setParameter
in interfaceQuery
- Specified by:
setParameter
in interfaceTypedQuery<R>
-
setParameter
Query<R> setParameter(Parameter<Date> param, Date value, TemporalType temporalType)
- Specified by:
setParameter
in interfaceQuery
- Specified by:
setParameter
in interfaceTypedQuery<R>
-
setParameter
Query<R> setParameter(String name, Calendar value, TemporalType temporalType)
- Specified by:
setParameter
in interfaceQuery
- Specified by:
setParameter
in interfaceTypedQuery<R>
-
setParameter
Query<R> setParameter(String name, Date value, TemporalType temporalType)
- Specified by:
setParameter
in interfaceQuery
- Specified by:
setParameter
in interfaceTypedQuery<R>
-
setParameter
Query<R> setParameter(int position, Calendar value, TemporalType temporalType)
- Specified by:
setParameter
in interfaceQuery
- Specified by:
setParameter
in interfaceTypedQuery<R>
-
setParameter
Query<R> setParameter(int position, Date value, TemporalType temporalType)
- Specified by:
setParameter
in interfaceQuery
- Specified by:
setParameter
in interfaceTypedQuery<R>
-
setParameterList
<P> Query<R> setParameterList(QueryParameter<P> parameter, Collection<P> values)
Bind multiple values to a query parameter using its inferred Type. The Hibernate type of the parameter values is first detected via the usage/position in the query and if not sufficient secondly guessed from the class of the first object in the collection. This is useful for binding a list of values to an expression such as foo.bar in (:value_list).- Parameters:
parameter
- the parameter mementovalues
- a collection of values to list- Returns:
this
, for method chaining
-
setParameterList
Query<R> setParameterList(String name, Collection<?> values)
Bind multiple values to a named query parameter. The Hibernate type of the parameter is first detected via the usage/position in the query and if not sufficient secondly guessed from the class of the first object in the collection. This is useful for binding a list of values to an expression such as foo.bar in (:value_list).- Parameters:
name
- the name of the parametervalues
- a collection of values to list- Returns:
this
, for method chaining
-
setParameterList
Query<R> setParameterList(int position, Collection<?> values)
Bind multiple values to a positional query parameter. The Hibernate type of the parameter is first detected via the usage/position in the query and if not sufficient secondly guessed from the class of the first object in the collection. This is useful for binding a list of values to an expression such as foo.bar in (:value_list).- Parameters:
position
- the parameter positional labelvalues
- a collection of values to list- Returns:
this
, for method chaining
-
setParameterList
<P> Query<R> setParameterList(String name, Collection<? extends P> values, Class<P> type)
Bind multiple values to a named query parameter. The Hibernate type of the parameter is first detected via the usage/position in the query and if not sufficient secondly guessed from the class of the first object in the collection. This is useful for binding a list of values to an expression such as foo.bar in (:value_list).- Parameters:
name
- the name of the parametervalues
- a collection of values to list- Returns:
this
, for method chaining
-
setParameterList
<P> Query<R> setParameterList(int position, Collection<? extends P> values, Class<P> type)
Bind multiple values to a positional query parameter. The Hibernate type of the parameter is first detected via the usage/position in the query and if not sufficient secondly guessed from the class of the first object in the collection. This is useful for binding a list of values to an expression such as foo.bar in (:value_list).- Parameters:
position
- the parameter positional labelvalues
- a collection of values to list- Returns:
this
, for method chaining
-
setParameterList
<P> Query<R> setParameterList(String name, Collection<? extends P> values, AllowableParameterType<P> type)
Bind multiple values to a named query parameter. This is useful for binding a list of values to an expression such as foo.bar in (:value_list).- Parameters:
name
- the name of the parametervalues
- a collection of values to listtype
- the Hibernate allowable parameter type of the values- Returns:
this
, for method chaining
-
setParameterList
<P> Query<R> setParameterList(int position, Collection<? extends P> values, AllowableParameterType<P> type)
Bind multiple values to a positional query parameter. This is useful for binding a list of values to an expression such as foo.bar in (?1).- Parameters:
position
- the parameter positional labelvalues
- a collection of values to listtype
- the Hibernate allowable parameter type of the values- Returns:
this
, for method chaining
-
setParameterList
Query<R> setParameterList(String name, Object[] values, AllowableParameterType<?> type)
Bind multiple values to a named query parameter. This is useful for binding a list of values to an expression such as foo.bar in (:value_list).- Parameters:
name
- the name of the parametervalues
- a collection of values to listtype
- the Hibernate type of the values- Returns:
this
, for method chaining
-
setParameterList
Query<R> setParameterList(int position, Object[] values, AllowableParameterType<?> type)
Bind multiple values to a named query parameter. This is useful for binding a list of values to an expression such as foo.bar in (:value_list).- Parameters:
position
- the parameter positional labelvalues
- a collection of values to listtype
- the Hibernate type of the values- Returns:
this
, for method chaining
-
setParameterList
Query<R> setParameterList(String name, Object[] values)
Bind multiple values to a named query parameter. The Hibernate type of the parameter is first detected via the usage/position in the query and if not sufficient secondly guessed from the class of the first object in the array. This is useful for binding a list of values to an expression such as foo.bar in (:value_list).- Parameters:
name
- the name of the parametervalues
- a collection of values to list- Returns:
this
, for method chaining
-
setParameterList
Query<R> setParameterList(int position, Object[] values)
Bind multiple values to a named query parameter. The Hibernate type of the parameter is first detected via the usage/position in the query and if not sufficient secondly guessed from the class of the first object in the array. This is useful for binding a list of values to an expression such as foo.bar in (:value_list).- Parameters:
position
- the parameter positional labelvalues
- a collection of values to list- Returns:
this
, for method chaining
-
setProperties
Query<R> setProperties(Object bean)
Bind the property values of the given bean to named parameters of the query, matching property names with parameter names and mapping property types to Hibernate types using heuristics.- Parameters:
bean
- any JavaBean or POJO- Returns:
this
, for method chaining
-
setProperties
Query<R> setProperties(Map bean)
Bind the values of the given Map for each named parameters of the query, matching key names with parameter names and mapping value types to Hibernate types using heuristics.- Parameters:
bean
- a java.util.Map- Returns:
this
, for method chaining
-
setResultTransformer
@Deprecated default Query<R> setResultTransformer(ResultTransformer transformer)
Deprecated.
-
-