Interface NativeQuery<T>
-
- All Superinterfaces:
CommonQueryContract
,MutationQuery
,Query
,Query<T>
,SelectionQuery<T>
,SynchronizeableQuery
,TypedQuery<T>
- All Known Subinterfaces:
NativeQueryImplementor<R>
- All Known Implementing Classes:
NativeQueryImpl
public interface NativeQuery<T> extends Query<T>, SynchronizeableQuery
Within the context of an active session, an instance of this type represents an executable query written in the native SQL dialect of the underlying database. Since Hibernate does not actually understand SQL, it often requires some help in interpreting the semantics of a native SQL query.Along with the operations inherited from
Query
, this interface provides control over:- mapping the result set of the native SQL query, and
- synchronization of the database with state held in memory before execution of the query, via automatic flushing of the session.
A
NativeQuery
may be obtained from theSession
by calling:QueryProducer.createNativeQuery(String, Class)
, passing native SQL as a string, orQueryProducer.createNativeQuery(String, String, Class)
passing the native SQL string and the name of a result set mapping defined usingSqlResultSetMapping
.
A result set mapping may be specified by:
- a named
SqlResultSetMapping
passed toQueryProducer.createNativeQuery(String, String, Class)
, - a named
SqlResultSetMapping
specified usingNamedNativeQuery.resultSetMapping()
for a named query, or - by calling the various
addEntity(java.lang.String)
,addRoot(java.lang.String, java.lang.String)
,addJoin(java.lang.String, java.lang.String)
,addFetch(java.lang.String, java.lang.String, java.lang.String)
andaddScalar(java.lang.String)
methods of this object.
The third option is a legacy of much older versions of Hibernate and is currently disfavored.
To determine if an automatic flush is required before execution of the query, Hibernate must know which tables affect the query result set. JPA provides no standard way to do this. Instead, this information may be provided via:
NamedNativeQuery.querySpaces()
for a named query, or- by calling
addSynchronizedEntityClass(java.lang.Class)
,addSynchronizedEntityName(java.lang.String)
, oraddSynchronizedQuerySpace(java.lang.String)
.
- See Also:
Query
,SynchronizeableQuery
,QueryProducer
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
NativeQuery.CollectionReturn
Allows access to further control how collection returns are mapped back from result sets.static interface
NativeQuery.FetchReturn
Allows access to further control how join fetch returns are mapped back from result sets.static interface
NativeQuery.InstantiationResultNode<J>
static interface
NativeQuery.ResultNode
Simple unification interface for all returns from the variousaddXYZ()
methods.static interface
NativeQuery.ReturnableResultNode
ANativeQuery.ResultNode
which can be a query result.static interface
NativeQuery.ReturnProperty
Allows access to further control how properties within a root or join fetch are mapped back from the result set.static interface
NativeQuery.RootReturn
Allows access to further control how root returns are mapped back from result sets.
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description NativeQuery<T>
addAttributeResult(String columnAlias, SingularAttribute attribute)
Defines a result based on a specified attribute.NativeQuery<T>
addAttributeResult(String columnAlias, Class entityJavaType, String attributePath)
Defines a result based on a specified attribute.NativeQuery<T>
addAttributeResult(String columnAlias, String entityName, String attributePath)
Defines a result based on a specified attribute.NativeQuery<T>
addEntity(Class entityType)
Declare a "root" entity, without specifying an alias.NativeQuery<T>
addEntity(String entityName)
Declare a "root" entity, without specifying an alias.NativeQuery<T>
addEntity(String tableAlias, Class entityType)
Declare a "root" entity.NativeQuery<T>
addEntity(String tableAlias, Class entityClass, LockMode lockMode)
Declare a "root" entity, specifying a lock mode.NativeQuery<T>
addEntity(String tableAlias, String entityName)
Declare a "root" entity.NativeQuery<T>
addEntity(String tableAlias, String entityName, LockMode lockMode)
Declare a "root" entity, specifying a lock mode.NativeQuery.FetchReturn
addFetch(String tableAlias, String ownerTableAlias, String joinPropertyName)
Declare a join fetch result.<J> NativeQuery.InstantiationResultNode<J>
addInstantiation(Class<J> targetJavaType)
NativeQuery<T>
addJoin(String tableAlias, String path)
Declare a join fetch result.NativeQuery<T>
addJoin(String tableAlias, String ownerTableAlias, String joinPropertyName)
Declare a join fetch result.NativeQuery<T>
addJoin(String tableAlias, String path, LockMode lockMode)
Declare a join fetch result, specifying a lock mode.NativeQuery<T>
addQueryHint(String hint)
Add a database query hint to the SQL query.NativeQuery.RootReturn
addRoot(String tableAlias, Class entityType)
Add a new root return mapping, returning aNativeQuery.RootReturn
to allow further definition.NativeQuery.RootReturn
addRoot(String tableAlias, String entityName)
Add a new root return mapping, returning aNativeQuery.RootReturn
to allow further definition.NativeQuery<T>
addScalar(String columnAlias)
Declare a scalar query result.NativeQuery<T>
addScalar(String columnAlias, Class javaType)
Declare a scalar query result using the specified result type.<C> NativeQuery<T>
addScalar(String columnAlias, Class<C> relationalJavaType, AttributeConverter<?,C> converter)
Declare a scalar query result with an explicit conversion.<C> NativeQuery<T>
addScalar(String columnAlias, Class<C> relationalJavaType, Class<? extends AttributeConverter<?,C>> converter)
Declare a scalar query result with an explicit conversion.<O,R>
NativeQuery<T>addScalar(String columnAlias, Class<O> domainJavaType, Class<R> jdbcJavaType, AttributeConverter<O,R> converter)
Declare a scalar query result with an explicit conversion.<O,R>
NativeQuery<T>addScalar(String columnAlias, Class<O> domainJavaType, Class<R> jdbcJavaType, Class<? extends AttributeConverter<O,R>> converter)
Declare a scalar query result with an explicit conversion.NativeQuery<T>
addScalar(String columnAlias, BasicDomainType type)
Declare a scalar query result.NativeQuery<T>
addScalar(String columnAlias, BasicTypeReference type)
Declare a scalar query result.NativeQuery<T>
addSynchronizedEntityClass(Class entityClass)
Add all query spaces associated with the entity with the given type.NativeQuery<T>
addSynchronizedEntityName(String entityName)
Add all query spaces associated with the entity with the given names.NativeQuery<T>
addSynchronizedQuerySpace(String querySpace)
Add a query space.LockMode
getHibernateLockMode()
Get the rootLockMode
for the queryLockModeType
getLockMode()
Not applicable to native SQL queries, due to an unfortunate requirement of the JPA specification.LockOptions
getLockOptions()
Obtains theLockOptions
in effect for this query.NativeQuery<T>
setCacheable(boolean cacheable)
Enable/disable second level query (result) caching for this query.NativeQuery<T>
setCacheMode(CacheMode cacheMode)
Set the currentCacheMode
in effect for this query.NativeQuery<T>
setCacheRegion(String cacheRegion)
Set the name of the cache region where query results should be cached (assumingSelectionQuery.isCacheable()
).NativeQuery<T>
setCacheRetrieveMode(CacheRetrieveMode cacheRetrieveMode)
NativeQuery<T>
setCacheStoreMode(CacheStoreMode cacheStoreMode)
NativeQuery<T>
setComment(String comment)
Set the comment for this query.NativeQuery<T>
setFetchSize(int fetchSize)
Sets a JDBC fetch size hint for the query.NativeQuery<T>
setFirstResult(int startPosition)
Set the first row position to return from the query results.NativeQuery<T>
setFlushMode(FlushModeType flushMode)
Set theFlushMode
in to use for this query.NativeQuery<T>
setHibernateFlushMode(FlushMode flushMode)
Set the currentFlushMode
in effect for this query.NativeQuery<T>
setHibernateLockMode(LockMode lockMode)
Specify the rootLockMode
for the queryNativeQuery<T>
setHint(String hintName, Object value)
Set a hint.NativeQuery<T>
setLockMode(LockModeType lockMode)
Not applicable to native SQL queries, due to an unfortunate requirement of the JPA specification.NativeQuery<T>
setLockMode(String alias, LockMode lockMode)
Not applicable to native SQL queries.NativeQuery<T>
setLockOptions(LockOptions lockOptions)
Apply the given lock options to this query.NativeQuery<T>
setMaxResults(int maxResult)
Set the max number of rows requested for the query results.NativeQuery<T>
setParameter(int position, Object value)
Bind the given argument to an ordinal query parameter.NativeQuery<T>
setParameter(int position, Instant value, TemporalType temporalType)
Bind anInstant
value to the ordinal query parameter using just the portion indicated by the givenTemporalType
.NativeQuery<T>
setParameter(int position, Calendar value, TemporalType temporalType)
Query
overrideNativeQuery<T>
setParameter(int position, Date value, TemporalType temporalType)
Query
override<P> NativeQuery<T>
setParameter(int position, P val, Class<P> type)
Bind the given argument to an ordinal query parameter using the given Class reference to attempt to determine theBindableType
to use.<P> NativeQuery<T>
setParameter(int position, P val, BindableType<P> type)
Bind the given argument to an ordinal query parameter using the givenBindableType
.NativeQuery<T>
setParameter(Parameter<Calendar> param, Calendar value, TemporalType temporalType)
Query
overrideNativeQuery<T>
setParameter(Parameter<Date> param, Date value, TemporalType temporalType)
Query
override<P> NativeQuery<T>
setParameter(Parameter<P> param, P value)
Query
overrideNativeQuery<T>
setParameter(String name, Object value)
Bind the given argument to a named query parameter.NativeQuery<T>
setParameter(String name, Instant value, TemporalType temporalType)
Bind anInstant
value to the named query parameter using just the portion indicated by the givenTemporalType
.NativeQuery<T>
setParameter(String name, Calendar value, TemporalType temporalType)
Query
overrideNativeQuery<T>
setParameter(String name, Date value, TemporalType temporalType)
Query
override<P> NativeQuery<T>
setParameter(String name, P val, Class<P> type)
Bind the given argument to a named query parameter using the given Class reference to attempt to determine theBindableType
to use.<P> NativeQuery<T>
setParameter(String name, P val, BindableType<P> type)
Bind the given argument to a named query parameter using the givenBindableType
.<P> NativeQuery<T>
setParameter(QueryParameter<P> parameter, P val)
Bind an argument to the query parameter represented by the givenQueryParameter
.<P> NativeQuery<T>
setParameter(QueryParameter<P> parameter, P val, Class<P> type)
Bind an argument to the query parameter represented by the givenQueryParameter
using the given Class reference to attempt to determine theBindableType
to use.<P> NativeQuery<T>
setParameter(QueryParameter<P> parameter, P val, BindableType<P> type)
Bind an argument to the query parameter represented by the givenQueryParameter
using the givenBindableType
.NativeQuery<T>
setParameterList(int position, Object[] values)
Bind multiple arguments to an ordinal query parameter.NativeQuery<T>
setParameterList(int position, Collection values)
Bind multiple arguments to an ordinal query parameter.<P> NativeQuery<T>
setParameterList(int position, Collection<? extends P> values, Class<P> type)
Bind multiple arguments to an ordinal query parameter using the given Class reference to attempt to determine theBindableType
to use.<P> NativeQuery<T>
setParameterList(int position, Collection<? extends P> values, BindableType<P> javaType)
Bind multiple arguments to an ordinal query parameter using the givenBindableType
.<P> NativeQuery<T>
setParameterList(int position, P[] values, Class<P> javaType)
Bind multiple arguments to an ordinal query parameter using the givenClass
reference to attempt to determine theBindableType
to use.<P> NativeQuery<T>
setParameterList(int position, P[] values, BindableType<P> javaType)
Bind multiple arguments to an ordinal query parameter using the givenBindableType
.NativeQuery<T>
setParameterList(String name, Object[] values)
Bind multiple arguments to a named query parameter.NativeQuery<T>
setParameterList(String name, Collection values)
Bind multiple arguments to a named query parameter.<P> NativeQuery<T>
setParameterList(String name, Collection<? extends P> values, Class<P> type)
Bind multiple arguments to a named query parameter using the given Class reference to attempt to determine theBindableType
to use.<P> NativeQuery<T>
setParameterList(String name, Collection<? extends P> values, BindableType<P> type)
Bind multiple arguments to a named query parameter using the givenBindableType
.<P> NativeQuery<T>
setParameterList(String name, P[] values, Class<P> type)
Bind multiple arguments to a named query parameter using the given Class reference to attempt to determine theBindableType
to use.<P> NativeQuery<T>
setParameterList(String name, P[] values, BindableType<P> type)
Bind multiple arguments to a named query parameter using the givenBindableType
.<P> NativeQuery<T>
setParameterList(QueryParameter<P> parameter, Collection<? extends P> values)
Bind multiple arguments to the query parameter represented by the givenQueryParameter
.<P> NativeQuery<T>
setParameterList(QueryParameter<P> parameter, Collection<? extends P> values, Class<P> javaType)
Bind multiple arguments to the query parameter represented by the givenQueryParameter
using the given Class reference to attempt to determine theBindableType
to use.<P> NativeQuery<T>
setParameterList(QueryParameter<P> parameter, Collection<? extends P> values, BindableType<P> type)
Bind multiple arguments to the query parameter represented by the givenQueryParameter
, inferring theBindableType
.<P> NativeQuery<T>
setParameterList(QueryParameter<P> parameter, P[] values)
Bind multiple arguments to the query parameter represented by the givenQueryParameter
.<P> NativeQuery<T>
setParameterList(QueryParameter<P> parameter, P[] values, Class<P> javaType)
Bind multiple arguments to the query parameter represented by the givenQueryParameter
using the givenClass
reference to attempt to determine theBindableType
to use.<P> NativeQuery<T>
setParameterList(QueryParameter<P> parameter, P[] values, BindableType<P> type)
Bind multiple arguments to the query parameter represented by the givenQueryParameter
, inferring theBindableType
.NativeQuery<T>
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.NativeQuery<T>
setProperties(Map bean)
Bind the values of the givenMap
for each named parameters of the query, matching key names with parameter names and mapping value types to Hibernate types using heuristics.NativeQuery<T>
setReadOnly(boolean readOnly)
Set the read-only/modifiable mode for entities and proxies loaded by thisQuery
.NativeQuery<T>
setResultListTransformer(ResultListTransformer<T> transformer)
Set aResultListTransformer
.<S> NativeQuery<S>
setResultTransformer(ResultTransformer<S> transformer)
Deprecated.NativeQuery<T>
setTimeout(int timeout)
Set the query timeout in seconds.<R> NativeQuery<R>
setTupleTransformer(TupleTransformer<R> transformer)
Set aTupleTransformer
.-
Methods inherited from interface org.hibernate.query.CommonQueryContract
getFlushMode, getHibernateFlushMode, getTimeout
-
Methods inherited from interface jakarta.persistence.Query
getFirstResult, getFlushMode, getHints, getMaxResults, getParameter, getParameter, getParameter, getParameter, getParameters, getParameterValue, getParameterValue, getParameterValue, isBound, unwrap
-
Methods inherited from interface org.hibernate.query.Query
applyFetchGraph, applyGraph, applyLoadGraph, disableFetchProfile, enableFetchProfile, executeUpdate, getComment, getParameterMetadata, getQueryOptions, getQueryString, getResultList, getResultStream, getSession, getSingleResult, list, scroll, scroll, setEntityGraph, setOrder, setOrder, setPage, stream, uniqueResult, uniqueResultOptional
-
Methods inherited from interface org.hibernate.query.SelectionQuery
getCacheMode, getCacheRegion, getCacheRetrieveMode, getCacheStoreMode, getFetchSize, getFirstResult, getKeyedResultList, getMaxResults, getResultCount, getSingleResultOrNull, isCacheable, isQueryPlanCacheable, isReadOnly, setAliasSpecificLockMode, setFollowOnLocking, setQueryPlanCacheable
-
Methods inherited from interface org.hibernate.query.SynchronizeableQuery
getSynchronizedQuerySpaces
-
-
-
-
Method Detail
-
addScalar
NativeQuery<T> addScalar(String columnAlias)
Declare a scalar query result. Hibernate will attempt to automatically detect the underlying type.Functions like
<return-scalar/>
inhbm.xml
orColumnResult
in annotations- Parameters:
columnAlias
- The column alias in the result set to be processed as a scalar result- Returns:
this
, for method chaining
-
addScalar
NativeQuery<T> addScalar(String columnAlias, BasicTypeReference type)
Declare a scalar query result.Functions like
<return-scalar/>
inhbm.xml
orColumnResult
in annotations.- Parameters:
columnAlias
- The column alias in the result set to be processed as a scalar resulttype
- The Hibernate type as which to treat the value.- Returns:
this
, for method chaining
-
addScalar
NativeQuery<T> addScalar(String columnAlias, BasicDomainType type)
Declare a scalar query result.Functions like
<return-scalar/>
inhbm.xml
orColumnResult
in annotations.- Parameters:
columnAlias
- The column alias in the result set to be processed as a scalar resulttype
- The Hibernate type as which to treat the value.- Returns:
this
, for method chaining
-
addScalar
NativeQuery<T> addScalar(String columnAlias, Class javaType)
Declare a scalar query result using the specified result type.Hibernate will implicitly determine an appropriate conversion, if it can. Otherwise, an exception will be thrown.
- Returns:
this
, for method chaining- Since:
- 6.0
-
addScalar
<C> NativeQuery<T> addScalar(String columnAlias, Class<C> relationalJavaType, AttributeConverter<?,C> converter)
Declare a scalar query result with an explicit conversion.- Parameters:
relationalJavaType
- The Java type expected by the converter as its "relational" type.converter
- The conversion to apply. Consumes the JDBC value based onrelationalJavaType
.- Returns:
this
, for method chaining- Since:
- 6.0
-
addScalar
<O,R> NativeQuery<T> addScalar(String columnAlias, Class<O> domainJavaType, Class<R> jdbcJavaType, AttributeConverter<O,R> converter)
Declare a scalar query result with an explicit conversion.- Parameters:
jdbcJavaType
- The Java type expected by the converter as its "relational model" type.domainJavaType
- The Java type expected by the converter as its "object model" type.converter
- The conversion to apply. Consumes the JDBC value based onrelationalJavaType
.- Returns:
this
, for method chaining- Since:
- 6.0
-
addScalar
<C> NativeQuery<T> addScalar(String columnAlias, Class<C> relationalJavaType, Class<? extends AttributeConverter<?,C>> converter)
Declare a scalar query result with an explicit conversion.- Parameters:
relationalJavaType
- The Java type expected by the converter as its "relational" type.converter
- The conversion to apply. Consumes the JDBC value based onrelationalJavaType
.- Returns:
this
, for method chaining- Since:
- 6.0
-
addScalar
<O,R> NativeQuery<T> addScalar(String columnAlias, Class<O> domainJavaType, Class<R> jdbcJavaType, Class<? extends AttributeConverter<O,R>> converter)
Declare a scalar query result with an explicit conversion.- Parameters:
jdbcJavaType
- The Java type expected by the converter as its "relational model" type.domainJavaType
- The Java type expected by the converter as its "object model" type.converter
- The conversion to apply. Consumes the JDBC value based onrelationalJavaType
.- Returns:
this
, for method chaining- Since:
- 6.0
-
addInstantiation
<J> NativeQuery.InstantiationResultNode<J> addInstantiation(Class<J> targetJavaType)
-
addAttributeResult
NativeQuery<T> addAttributeResult(String columnAlias, Class entityJavaType, String attributePath)
Defines a result based on a specified attribute. Differs from adding a scalar in that any conversions or other semantics defined on the attribute are automatically applied to the mapping.- Returns:
this
, for method chaining- Since:
- 6.0
-
addAttributeResult
NativeQuery<T> addAttributeResult(String columnAlias, String entityName, String attributePath)
Defines a result based on a specified attribute. Differs from adding a scalar in that any conversions or other semantics defined on the attribute are automatically applied to the mapping.- Returns:
this
, for method chaining- Since:
- 6.0
-
addAttributeResult
NativeQuery<T> addAttributeResult(String columnAlias, SingularAttribute attribute)
Defines a result based on a specified attribute. Differs from adding a scalar in that any conversions or other semantics defined on the attribute are automatically applied to the mapping.This form accepts the JPA Attribute mapping describing the attribute
- Returns:
this
, for method chaining- Since:
- 6.0
-
addRoot
NativeQuery.RootReturn addRoot(String tableAlias, String entityName)
Add a new root return mapping, returning aNativeQuery.RootReturn
to allow further definition.- Parameters:
tableAlias
- The SQL table alias to map to this entityentityName
- The name of the entity- Returns:
- The return config object for further control.
- Since:
- 3.6
-
addRoot
NativeQuery.RootReturn addRoot(String tableAlias, Class entityType)
Add a new root return mapping, returning aNativeQuery.RootReturn
to allow further definition.- Parameters:
tableAlias
- The SQL table alias to map to this entityentityType
- The java type of the entity- Returns:
- The return config object for further control.
- Since:
- 3.6
-
addEntity
NativeQuery<T> addEntity(String entityName)
Declare a "root" entity, without specifying an alias. The expectation here is that the table alias is the same as the unqualified entity name.Use
addRoot(java.lang.String, java.lang.String)
if you need further control of the mapping- Parameters:
entityName
- The entity name that is the root return of the query- Returns:
this
, for method chaining
-
addEntity
NativeQuery<T> addEntity(String tableAlias, String entityName)
Declare a "root" entity.- Parameters:
tableAlias
- The SQL table aliasentityName
- The entity name- Returns:
this
, for method chaining
-
addEntity
NativeQuery<T> addEntity(String tableAlias, String entityName, LockMode lockMode)
Declare a "root" entity, specifying a lock mode.- Parameters:
tableAlias
- The SQL table aliasentityName
- The entity namelockMode
- The lock mode for this return.- Returns:
this
, for method chaining
-
addEntity
NativeQuery<T> addEntity(Class entityType)
Declare a "root" entity, without specifying an alias. The expectation here is that the table alias is the same as the unqualified entity name.- Parameters:
entityType
- The java type of the entity to add as a root- Returns:
this
, for method chaining
-
addEntity
NativeQuery<T> addEntity(String tableAlias, Class entityType)
Declare a "root" entity.- Parameters:
tableAlias
- The SQL table aliasentityType
- The java type of the entity to add as a root- Returns:
this
, for method chaining
-
addEntity
NativeQuery<T> addEntity(String tableAlias, Class entityClass, LockMode lockMode)
Declare a "root" entity, specifying a lock mode.- Parameters:
tableAlias
- The SQL table aliasentityClass
- The entityClass
lockMode
- The lock mode for this return- Returns:
this
, for method chaining
-
addFetch
NativeQuery.FetchReturn addFetch(String tableAlias, String ownerTableAlias, String joinPropertyName)
Declare a join fetch result.- Parameters:
tableAlias
- The SQL table alias for the data to be mapped to this fetch.ownerTableAlias
- Identify the table alias of the owner of this association. Should match the alias of a previously added root or fetch.joinPropertyName
- The name of the property being join fetched.- Returns:
- The return config object for further control.
- Since:
- 3.6
-
addJoin
NativeQuery<T> addJoin(String tableAlias, String path)
Declare a join fetch result.- Parameters:
tableAlias
- The SQL table alias for the data to be mapped to this fetch.path
- The association path of form[owner-alias].[property-name]
.- Returns:
this
, for method chaining
-
addJoin
NativeQuery<T> addJoin(String tableAlias, String ownerTableAlias, String joinPropertyName)
Declare a join fetch result.- Parameters:
tableAlias
- The SQL table alias for the data to be mapped to this fetchownerTableAlias
- Identify the table alias of the owner of this association. Should match the alias of a previously added root or fetch.joinPropertyName
- The name of the property being join fetched.- Returns:
this
, for method chaining- Since:
- 3.6
-
addJoin
NativeQuery<T> addJoin(String tableAlias, String path, LockMode lockMode)
Declare a join fetch result, specifying a lock mode.- Parameters:
tableAlias
- The SQL table alias for the data to be mapped to this fetchpath
- The association path of form[owner-alias].[property-name]
.lockMode
- The lock mode for this return.- Returns:
this
, for method chaining
-
addSynchronizedQuerySpace
NativeQuery<T> addSynchronizedQuerySpace(String querySpace)
Description copied from interface:SynchronizeableQuery
Add a query space. The effect of this call is to:- force an auto-flush if any entity associated with the current session and mapped to the given query space has pending changes which have not yet been synchronized with the database, and
- if the result set of this query is cached, mark it for invalidation when any entity mapped to the given query space is synchronized with the database in any session.
- Specified by:
addSynchronizedQuerySpace
in interfaceSynchronizeableQuery
- Parameters:
querySpace
- The name of the query space, usually the name of a database table.- Returns:
this
, for method chaining
-
addSynchronizedEntityName
NativeQuery<T> addSynchronizedEntityName(String entityName) throws MappingException
Description copied from interface:SynchronizeableQuery
Add all query spaces associated with the entity with the given names.Same as
SynchronizeableQuery.addSynchronizedQuerySpace(java.lang.String)
for all tables mapped by the given entity.- Specified by:
addSynchronizedEntityName
in interfaceSynchronizeableQuery
- Parameters:
entityName
- The name of an entity.- Returns:
this
, for method chaining- Throws:
MappingException
- Indicates the given name could not be resolved as an entity
-
addSynchronizedEntityClass
NativeQuery<T> addSynchronizedEntityClass(Class entityClass) throws MappingException
Description copied from interface:SynchronizeableQuery
Add all query spaces associated with the entity with the given type.Same as
SynchronizeableQuery.addSynchronizedQuerySpace(java.lang.String)
for all tables mapped by the given entity.- Specified by:
addSynchronizedEntityClass
in interfaceSynchronizeableQuery
- Parameters:
entityClass
- The class of the entity.- Returns:
this
, for method chaining- Throws:
MappingException
- Indicates the given class could not be resolved as an entity
-
setHibernateFlushMode
NativeQuery<T> setHibernateFlushMode(FlushMode flushMode)
Description copied from interface:CommonQueryContract
Set the currentFlushMode
in effect for this query.- Specified by:
setHibernateFlushMode
in interfaceCommonQueryContract
- Specified by:
setHibernateFlushMode
in interfaceMutationQuery
- Specified by:
setHibernateFlushMode
in interfaceQuery<T>
- Specified by:
setHibernateFlushMode
in interfaceSelectionQuery<T>
- See Also:
CommonQueryContract.getHibernateFlushMode()
,Session.getHibernateFlushMode()
-
setFlushMode
NativeQuery<T> setFlushMode(FlushModeType flushMode)
Description copied from interface:CommonQueryContract
Set theFlushMode
in to use for this query.- Specified by:
setFlushMode
in interfaceCommonQueryContract
- Specified by:
setFlushMode
in interfaceMutationQuery
- Specified by:
setFlushMode
in interfaceQuery
- Specified by:
setFlushMode
in interfaceQuery<T>
- Specified by:
setFlushMode
in interfaceSelectionQuery<T>
- Specified by:
setFlushMode
in interfaceTypedQuery<T>
- See Also:
CommonQueryContract.getHibernateFlushMode()
,Session.getHibernateFlushMode()
-
setCacheMode
NativeQuery<T> setCacheMode(CacheMode cacheMode)
Description copied from interface:SelectionQuery
Set the currentCacheMode
in effect for this query.- Specified by:
setCacheMode
in interfaceQuery<T>
- Specified by:
setCacheMode
in interfaceSelectionQuery<T>
- See Also:
SelectionQuery.getCacheMode()
,Session.setCacheMode(CacheMode)
-
setCacheStoreMode
NativeQuery<T> setCacheStoreMode(CacheStoreMode cacheStoreMode)
- Specified by:
setCacheStoreMode
in interfaceQuery<T>
- Specified by:
setCacheStoreMode
in interfaceSelectionQuery<T>
- See Also:
SelectionQuery.setCacheMode(CacheMode)
-
setCacheRetrieveMode
NativeQuery<T> setCacheRetrieveMode(CacheRetrieveMode cacheRetrieveMode)
- Specified by:
setCacheRetrieveMode
in interfaceQuery<T>
- Specified by:
setCacheRetrieveMode
in interfaceSelectionQuery<T>
- See Also:
SelectionQuery.setCacheMode(CacheMode)
-
setCacheable
NativeQuery<T> setCacheable(boolean cacheable)
Description copied from interface:SelectionQuery
Enable/disable second level query (result) caching for this query.- Specified by:
setCacheable
in interfaceQuery<T>
- Specified by:
setCacheable
in interfaceSelectionQuery<T>
- See Also:
SelectionQuery.isCacheable()
-
setCacheRegion
NativeQuery<T> setCacheRegion(String cacheRegion)
Description copied from interface:SelectionQuery
Set the name of the cache region where query results should be cached (assumingSelectionQuery.isCacheable()
).null
indicates to use the default region.- Specified by:
setCacheRegion
in interfaceQuery<T>
- Specified by:
setCacheRegion
in interfaceSelectionQuery<T>
- See Also:
SelectionQuery.getCacheRegion()
-
setTimeout
NativeQuery<T> setTimeout(int timeout)
Description copied from interface:CommonQueryContract
Set the query timeout in seconds.Any value set here is eventually passed directly along to the JDBC statement, which expressly disallows negative values. So negative values should be avoided as a general rule.
A value of zero indicates no timeout.
- Specified by:
setTimeout
in interfaceCommonQueryContract
- Specified by:
setTimeout
in interfaceMutationQuery
- Specified by:
setTimeout
in interfaceQuery<T>
- Specified by:
setTimeout
in interfaceSelectionQuery<T>
- Parameters:
timeout
- the timeout in seconds- Returns:
this
, for method chaining- See Also:
CommonQueryContract.getTimeout()
-
setFetchSize
NativeQuery<T> setFetchSize(int fetchSize)
Description copied from interface:SelectionQuery
Sets a JDBC fetch size hint for the query.- Specified by:
setFetchSize
in interfaceQuery<T>
- Specified by:
setFetchSize
in interfaceSelectionQuery<T>
- Parameters:
fetchSize
- the fetch size hint- Returns:
this
, for method chaining- See Also:
SelectionQuery.getFetchSize()
-
setReadOnly
NativeQuery<T> setReadOnly(boolean readOnly)
Description copied from interface:SelectionQuery
Set the read-only/modifiable mode for entities and proxies loaded by thisQuery
. This setting overrides the default setting for the persistence context,Session.isDefaultReadOnly()
.To set the default read-only/modifiable setting used for entities and proxies that are loaded into the session, use
Session.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.
- Specified by:
setReadOnly
in interfaceQuery<T>
- Specified by:
setReadOnly
in interfaceSelectionQuery<T>
- 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
-
getLockOptions
LockOptions getLockOptions()
Description copied from interface:Query
Obtains theLockOptions
in effect for this query.- Specified by:
getLockOptions
in interfaceQuery<T>
- Specified by:
getLockOptions
in interfaceSelectionQuery<T>
- Returns:
- The
LockOptions
currently in effect - See Also:
LockOptions
-
setLockOptions
NativeQuery<T> setLockOptions(LockOptions lockOptions)
Description copied from interface:Query
Apply the given lock options to this query. Alias-specific lock modes in the given lock options are merged with any alias-specific lock mode which have already been set. If a lock mode has already been specified for an alias that is among the aliases in the given lock options, the lock mode specified in the given lock options overrides the lock mode that was already set.- Specified by:
setLockOptions
in interfaceQuery<T>
- Parameters:
lockOptions
- The lock options to apply to the query.- Returns:
this
, for method chaining- See Also:
Query.getLockOptions()
-
setLockMode
NativeQuery<T> setLockMode(String alias, LockMode lockMode)
Not applicable to native SQL queries.- Specified by:
setLockMode
in interfaceQuery<T>
- Specified by:
setLockMode
in interfaceSelectionQuery<T>
- Parameters:
alias
- A query aliaslockMode
- The lock mode to apply- Returns:
this
, for method chaining- Throws:
IllegalStateException
- for consistency with JPA- See Also:
Query.getLockOptions()
-
setComment
NativeQuery<T> setComment(String comment)
Description copied from interface:Query
Set the comment for this query.If SQL commenting is enabled, the comment will be added to the SQL query sent to the database, which may be useful for identifying the source of troublesome queries.
SQL commenting may be enabled using the configuration property "hibernate.use_sql_comments".
- Specified by:
setComment
in interfaceCommonQueryContract
- Specified by:
setComment
in interfaceMutationQuery
- Specified by:
setComment
in interfaceQuery<T>
- Specified by:
setComment
in interfaceSelectionQuery<T>
- Parameters:
comment
- The human-readable comment- Returns:
this
, for method chaining- See Also:
Query.getComment()
-
addQueryHint
NativeQuery<T> addQueryHint(String hint)
Description copied from interface:Query
Add a database query hint to the SQL query.A database hint is a completely different concept to a JPA hint specified using
QueryHint
orQuery.getHints()
. These are hints to the JPA provider.Multiple query hints may be specified. The operation
Dialect.getQueryHintString(String, List)
determines how the hint is actually added to the SQL query.- Specified by:
addQueryHint
in interfaceQuery<T>
- Parameters:
hint
- The database specific query hint to add.
-
setMaxResults
NativeQuery<T> setMaxResults(int maxResult)
Description copied from interface:SelectionQuery
Set the max number of rows requested for the query results. Applied to the SQL query- Specified by:
setMaxResults
in interfaceQuery
- Specified by:
setMaxResults
in interfaceQuery<T>
- Specified by:
setMaxResults
in interfaceSelectionQuery<T>
- Specified by:
setMaxResults
in interfaceTypedQuery<T>
-
setFirstResult
NativeQuery<T> setFirstResult(int startPosition)
Description copied from interface:SelectionQuery
Set the first row position to return from the query results. Applied to the SQL query.- Specified by:
setFirstResult
in interfaceQuery
- Specified by:
setFirstResult
in interfaceQuery<T>
- Specified by:
setFirstResult
in interfaceSelectionQuery<T>
- Specified by:
setFirstResult
in interfaceTypedQuery<T>
-
setHint
NativeQuery<T> setHint(String hintName, Object value)
Description copied from interface:CommonQueryContract
Set a hint. The hints understood by Hibernate are enumerated byAvailableHints
.- Specified by:
setHint
in interfaceCommonQueryContract
- Specified by:
setHint
in interfaceMutationQuery
- Specified by:
setHint
in interfaceQuery
- Specified by:
setHint
in interfaceQuery<T>
- Specified by:
setHint
in interfaceSelectionQuery<T>
- Specified by:
setHint
in interfaceTypedQuery<T>
- See Also:
HibernateHints
,SpecHints
-
getLockMode
LockModeType getLockMode()
Not applicable to native SQL queries, due to an unfortunate requirement of the JPA specification.Use
getHibernateLockMode()
to obtain the lock mode.- Specified by:
getLockMode
in interfaceQuery
- Specified by:
getLockMode
in interfaceSelectionQuery<T>
- Throws:
IllegalStateException
- as required by JPA- See Also:
SelectionQuery.getHibernateLockMode()
-
getHibernateLockMode
LockMode getHibernateLockMode()
Description copied from interface:SelectionQuery
Get the rootLockMode
for the query- Specified by:
getHibernateLockMode
in interfaceSelectionQuery<T>
- See Also:
SelectionQuery.getLockMode()
-
setLockMode
NativeQuery<T> setLockMode(LockModeType lockMode)
Not applicable to native SQL queries, due to an unfortunate requirement of the JPA specification.Use
setHibernateLockMode(LockMode)
or the hint named "org.hibernate.lockMode" to set the lock mode.- Specified by:
setLockMode
in interfaceQuery
- Specified by:
setLockMode
in interfaceQuery<T>
- Specified by:
setLockMode
in interfaceSelectionQuery<T>
- Specified by:
setLockMode
in interfaceTypedQuery<T>
- Throws:
IllegalStateException
- as required by JPA- See Also:
SelectionQuery.setHibernateLockMode(org.hibernate.LockMode)
-
setHibernateLockMode
NativeQuery<T> setHibernateLockMode(LockMode lockMode)
Description copied from interface:SelectionQuery
Specify the rootLockMode
for the query- Specified by:
setHibernateLockMode
in interfaceSelectionQuery<T>
- See Also:
SelectionQuery.setLockMode(LockModeType)
-
setTupleTransformer
<R> NativeQuery<R> setTupleTransformer(TupleTransformer<R> transformer)
Description copied from interface:Query
Set aTupleTransformer
.- Specified by:
setTupleTransformer
in interfaceQuery<T>
-
setResultListTransformer
NativeQuery<T> setResultListTransformer(ResultListTransformer<T> transformer)
Description copied from interface:Query
Set aResultListTransformer
.- Specified by:
setResultListTransformer
in interfaceQuery<T>
-
setResultTransformer
@Deprecated <S> NativeQuery<S> setResultTransformer(ResultTransformer<S> transformer)
Deprecated.- Specified by:
setResultTransformer
in interfaceQuery<T>
-
setParameter
NativeQuery<T> setParameter(String name, Object value)
Description copied from interface:Query
Bind the given argument to a named query parameter.If the type of the parameter cannot be inferred from the context in which it occurs, use one of the forms accept a "type".
- Specified by:
setParameter
in interfaceCommonQueryContract
- Specified by:
setParameter
in interfaceMutationQuery
- Specified by:
setParameter
in interfaceQuery
- Specified by:
setParameter
in interfaceQuery<T>
- Specified by:
setParameter
in interfaceSelectionQuery<T>
- Specified by:
setParameter
in interfaceTypedQuery<T>
- See Also:
Query.setParameter(String, Object, Class)
,Query.setParameter(String, Object, BindableType)
-
setParameter
<P> NativeQuery<T> setParameter(String name, P val, Class<P> type)
Description copied from interface:Query
Bind the given argument to a named query parameter using the given Class reference to attempt to determine theBindableType
to use. If unable to determine an appropriateBindableType
,Query.setParameter(String, Object)
is used.- Specified by:
setParameter
in interfaceCommonQueryContract
- Specified by:
setParameter
in interfaceMutationQuery
- Specified by:
setParameter
in interfaceQuery<T>
- Specified by:
setParameter
in interfaceSelectionQuery<T>
- See Also:
Query.setParameter(String, Object, BindableType)
-
setParameter
<P> NativeQuery<T> setParameter(String name, P val, BindableType<P> type)
Description copied from interface:Query
Bind the given argument to a named query parameter using the givenBindableType
.- Specified by:
setParameter
in interfaceCommonQueryContract
- Specified by:
setParameter
in interfaceMutationQuery
- Specified by:
setParameter
in interfaceQuery<T>
- Specified by:
setParameter
in interfaceSelectionQuery<T>
-
setParameter
NativeQuery<T> setParameter(String name, Instant value, TemporalType temporalType)
Description copied from interface:Query
Bind anInstant
value to the named query parameter using just the portion indicated by the givenTemporalType
.- Specified by:
setParameter
in interfaceCommonQueryContract
- Specified by:
setParameter
in interfaceMutationQuery
- Specified by:
setParameter
in interfaceQuery<T>
- Specified by:
setParameter
in interfaceSelectionQuery<T>
-
setParameter
NativeQuery<T> setParameter(String name, Calendar value, TemporalType temporalType)
Description copied from interface:Query
Query
override- Specified by:
setParameter
in interfaceCommonQueryContract
- Specified by:
setParameter
in interfaceMutationQuery
- Specified by:
setParameter
in interfaceQuery
- Specified by:
setParameter
in interfaceQuery<T>
- Specified by:
setParameter
in interfaceSelectionQuery<T>
- Specified by:
setParameter
in interfaceTypedQuery<T>
- See Also:
Query.setParameter(String, Calendar, TemporalType)
-
setParameter
NativeQuery<T> setParameter(String name, Date value, TemporalType temporalType)
Description copied from interface:Query
Query
override- Specified by:
setParameter
in interfaceCommonQueryContract
- Specified by:
setParameter
in interfaceMutationQuery
- Specified by:
setParameter
in interfaceQuery
- Specified by:
setParameter
in interfaceQuery<T>
- Specified by:
setParameter
in interfaceSelectionQuery<T>
- Specified by:
setParameter
in interfaceTypedQuery<T>
- See Also:
Query.setParameter(String, Date, TemporalType)
-
setParameter
NativeQuery<T> setParameter(int position, Object value)
Description copied from interface:Query
Bind the given argument to an ordinal query parameter.If the type of the parameter cannot be inferred from the context in which it occurs, use one of the forms which accepts a "type".
- Specified by:
setParameter
in interfaceCommonQueryContract
- Specified by:
setParameter
in interfaceMutationQuery
- Specified by:
setParameter
in interfaceQuery
- Specified by:
setParameter
in interfaceQuery<T>
- Specified by:
setParameter
in interfaceSelectionQuery<T>
- Specified by:
setParameter
in interfaceTypedQuery<T>
- See Also:
Query.setParameter(int, Object, Class)
,Query.setParameter(int, Object, BindableType)
-
setParameter
<P> NativeQuery<T> setParameter(int position, P val, Class<P> type)
Description copied from interface:Query
Bind the given argument to an ordinal query parameter using the given Class reference to attempt to determine theBindableType
to use. If unable to determine an appropriateBindableType
,Query.setParameter(int, Object)
is used.- Specified by:
setParameter
in interfaceCommonQueryContract
- Specified by:
setParameter
in interfaceMutationQuery
- Specified by:
setParameter
in interfaceQuery<T>
- Specified by:
setParameter
in interfaceSelectionQuery<T>
- See Also:
Query.setParameter(int, Object, BindableType)
-
setParameter
<P> NativeQuery<T> setParameter(int position, P val, BindableType<P> type)
Description copied from interface:Query
Bind the given argument to an ordinal query parameter using the givenBindableType
.- Specified by:
setParameter
in interfaceCommonQueryContract
- Specified by:
setParameter
in interfaceMutationQuery
- Specified by:
setParameter
in interfaceQuery<T>
- Specified by:
setParameter
in interfaceSelectionQuery<T>
-
setParameter
NativeQuery<T> setParameter(int position, Instant value, TemporalType temporalType)
Description copied from interface:Query
Bind anInstant
value to the ordinal query parameter using just the portion indicated by the givenTemporalType
.- Specified by:
setParameter
in interfaceCommonQueryContract
- Specified by:
setParameter
in interfaceMutationQuery
- Specified by:
setParameter
in interfaceQuery<T>
- Specified by:
setParameter
in interfaceSelectionQuery<T>
-
setParameter
NativeQuery<T> setParameter(int position, Calendar value, TemporalType temporalType)
Description copied from interface:Query
Query
override- Specified by:
setParameter
in interfaceCommonQueryContract
- Specified by:
setParameter
in interfaceMutationQuery
- Specified by:
setParameter
in interfaceQuery
- Specified by:
setParameter
in interfaceQuery<T>
- Specified by:
setParameter
in interfaceSelectionQuery<T>
- Specified by:
setParameter
in interfaceTypedQuery<T>
- See Also:
Query.setParameter(int, Calendar, TemporalType)
-
setParameter
NativeQuery<T> setParameter(int position, Date value, TemporalType temporalType)
Description copied from interface:Query
Query
override- Specified by:
setParameter
in interfaceCommonQueryContract
- Specified by:
setParameter
in interfaceMutationQuery
- Specified by:
setParameter
in interfaceQuery
- Specified by:
setParameter
in interfaceQuery<T>
- Specified by:
setParameter
in interfaceSelectionQuery<T>
- Specified by:
setParameter
in interfaceTypedQuery<T>
- See Also:
Query.setParameter(int, Date, TemporalType)
-
setParameter
<P> NativeQuery<T> setParameter(QueryParameter<P> parameter, P val)
Description copied from interface:Query
Bind an argument to the query parameter represented by the givenQueryParameter
.If the type of the parameter cannot be inferred from the context in which it occurs, use one of the forms which accepts a "type".
- Specified by:
setParameter
in interfaceCommonQueryContract
- Specified by:
setParameter
in interfaceMutationQuery
- Specified by:
setParameter
in interfaceQuery<T>
- Specified by:
setParameter
in interfaceSelectionQuery<T>
- Parameters:
parameter
- the query parameter mementoval
- the argument, which might be null- Returns:
this
, for method chaining- See Also:
Query.setParameter(QueryParameter, Object, BindableType)
-
setParameter
<P> NativeQuery<T> setParameter(QueryParameter<P> parameter, P val, Class<P> type)
Description copied from interface:Query
Bind an argument to the query parameter represented by the givenQueryParameter
using the given Class reference to attempt to determine theBindableType
to use. If unable to determine an appropriateBindableType
,Query.setParameter(QueryParameter, Object)
is used- Specified by:
setParameter
in interfaceCommonQueryContract
- Specified by:
setParameter
in interfaceMutationQuery
- Specified by:
setParameter
in interfaceQuery<T>
- Specified by:
setParameter
in interfaceSelectionQuery<T>
- Parameters:
parameter
- the query parameter mementoval
- the argument, which might be nulltype
- aBindableType
representing the type of the parameter- Returns:
this
, for method chaining- See Also:
Query.setParameter(QueryParameter, Object, BindableType)
-
setParameter
<P> NativeQuery<T> setParameter(QueryParameter<P> parameter, P val, BindableType<P> type)
Description copied from interface:Query
Bind an argument to the query parameter represented by the givenQueryParameter
using the givenBindableType
.- Specified by:
setParameter
in interfaceCommonQueryContract
- Specified by:
setParameter
in interfaceMutationQuery
- Specified by:
setParameter
in interfaceQuery<T>
- Specified by:
setParameter
in interfaceSelectionQuery<T>
- Parameters:
parameter
- the query parameter mementoval
- the argument, which might be nulltype
- anBindableType
representing the type of the parameter- Returns:
this
, for method chaining
-
setParameter
<P> NativeQuery<T> setParameter(Parameter<P> param, P value)
Description copied from interface:Query
Query
override- Specified by:
setParameter
in interfaceCommonQueryContract
- Specified by:
setParameter
in interfaceMutationQuery
- Specified by:
setParameter
in interfaceQuery
- Specified by:
setParameter
in interfaceQuery<T>
- Specified by:
setParameter
in interfaceSelectionQuery<T>
- Specified by:
setParameter
in interfaceTypedQuery<T>
- See Also:
Query.setParameter(Parameter, Object)
-
setParameter
NativeQuery<T> setParameter(Parameter<Calendar> param, Calendar value, TemporalType temporalType)
Description copied from interface:Query
Query
override- Specified by:
setParameter
in interfaceCommonQueryContract
- Specified by:
setParameter
in interfaceMutationQuery
- Specified by:
setParameter
in interfaceQuery
- Specified by:
setParameter
in interfaceQuery<T>
- Specified by:
setParameter
in interfaceSelectionQuery<T>
- Specified by:
setParameter
in interfaceTypedQuery<T>
- See Also:
Query.setParameter(Parameter, Calendar, TemporalType)
-
setParameter
NativeQuery<T> setParameter(Parameter<Date> param, Date value, TemporalType temporalType)
Description copied from interface:Query
Query
override- Specified by:
setParameter
in interfaceCommonQueryContract
- Specified by:
setParameter
in interfaceMutationQuery
- Specified by:
setParameter
in interfaceQuery
- Specified by:
setParameter
in interfaceQuery<T>
- Specified by:
setParameter
in interfaceSelectionQuery<T>
- Specified by:
setParameter
in interfaceTypedQuery<T>
- See Also:
Query.setParameter(Parameter, Date, TemporalType)
-
setParameterList
NativeQuery<T> setParameterList(String name, Collection values)
Description copied from interface:Query
Bind multiple arguments to a named query parameter.The "type mapping" for the binding is inferred from the type of the first collection element.
- Specified by:
setParameterList
in interfaceCommonQueryContract
- Specified by:
setParameterList
in interfaceMutationQuery
- Specified by:
setParameterList
in interfaceQuery<T>
- Specified by:
setParameterList
in interfaceSelectionQuery<T>
- Returns:
this
, for method chaining- See Also:
Query.setParameterList(java.lang.String, java.util.Collection, BindableType)
-
setParameterList
<P> NativeQuery<T> setParameterList(String name, Collection<? extends P> values, Class<P> type)
Description copied from interface:Query
Bind multiple arguments to a named query parameter using the given Class reference to attempt to determine theBindableType
to use. If unable to determine an appropriateBindableType
,Query.setParameterList(String, Collection)
is used.- Specified by:
setParameterList
in interfaceCommonQueryContract
- Specified by:
setParameterList
in interfaceMutationQuery
- Specified by:
setParameterList
in interfaceQuery<T>
- Specified by:
setParameterList
in interfaceSelectionQuery<T>
- Returns:
this
, for method chaining- See Also:
Query.setParameterList(java.lang.String, java.util.Collection, BindableType)
-
setParameterList
<P> NativeQuery<T> setParameterList(String name, Collection<? extends P> values, BindableType<P> type)
Description copied from interface:Query
Bind multiple arguments to a named query parameter using the givenBindableType
.- Specified by:
setParameterList
in interfaceCommonQueryContract
- Specified by:
setParameterList
in interfaceMutationQuery
- Specified by:
setParameterList
in interfaceQuery<T>
- Specified by:
setParameterList
in interfaceSelectionQuery<T>
- Returns:
this
, for method chaining
-
setParameterList
NativeQuery<T> setParameterList(String name, Object[] values)
Description copied from interface:Query
Bind multiple arguments to a named query parameter.The "type mapping" for the binding is inferred from the type of the first collection element.
- Specified by:
setParameterList
in interfaceCommonQueryContract
- Specified by:
setParameterList
in interfaceMutationQuery
- Specified by:
setParameterList
in interfaceQuery<T>
- Specified by:
setParameterList
in interfaceSelectionQuery<T>
- Returns:
this
, for method chaining
-
setParameterList
<P> NativeQuery<T> setParameterList(String name, P[] values, Class<P> type)
Description copied from interface:Query
Bind multiple arguments to a named query parameter using the given Class reference to attempt to determine theBindableType
to use. If unable to determine an appropriateBindableType
,Query.setParameterList(String, Collection)
is used.- Specified by:
setParameterList
in interfaceCommonQueryContract
- Specified by:
setParameterList
in interfaceMutationQuery
- Specified by:
setParameterList
in interfaceQuery<T>
- Specified by:
setParameterList
in interfaceSelectionQuery<T>
- Returns:
this
, for method chaining- See Also:
Query.setParameterList(java.lang.String, Object[], BindableType)
-
setParameterList
<P> NativeQuery<T> setParameterList(String name, P[] values, BindableType<P> type)
Description copied from interface:Query
Bind multiple arguments to a named query parameter using the givenBindableType
.- Specified by:
setParameterList
in interfaceCommonQueryContract
- Specified by:
setParameterList
in interfaceMutationQuery
- Specified by:
setParameterList
in interfaceQuery<T>
- Specified by:
setParameterList
in interfaceSelectionQuery<T>
- Returns:
this
, for method chaining
-
setParameterList
NativeQuery<T> setParameterList(int position, Collection values)
Description copied from interface:Query
Bind multiple arguments to an ordinal query parameter.The "type mapping" for the binding is inferred from the type of the first collection element.
- Specified by:
setParameterList
in interfaceCommonQueryContract
- Specified by:
setParameterList
in interfaceMutationQuery
- Specified by:
setParameterList
in interfaceQuery<T>
- Specified by:
setParameterList
in interfaceSelectionQuery<T>
- Returns:
this
, for method chaining
-
setParameterList
<P> NativeQuery<T> setParameterList(int position, Collection<? extends P> values, Class<P> type)
Description copied from interface:Query
Bind multiple arguments to an ordinal query parameter using the given Class reference to attempt to determine theBindableType
to use. If unable to determine an appropriateBindableType
,Query.setParameterList(String, Collection)
is used.- Specified by:
setParameterList
in interfaceCommonQueryContract
- Specified by:
setParameterList
in interfaceMutationQuery
- Specified by:
setParameterList
in interfaceQuery<T>
- Specified by:
setParameterList
in interfaceSelectionQuery<T>
- Returns:
this
, for method chaining- See Also:
Query.setParameterList(int, Collection, BindableType)
-
setParameterList
<P> NativeQuery<T> setParameterList(int position, Collection<? extends P> values, BindableType<P> javaType)
Description copied from interface:Query
Bind multiple arguments to an ordinal query parameter using the givenBindableType
.- Specified by:
setParameterList
in interfaceCommonQueryContract
- Specified by:
setParameterList
in interfaceMutationQuery
- Specified by:
setParameterList
in interfaceQuery<T>
- Specified by:
setParameterList
in interfaceSelectionQuery<T>
- Returns:
this
, for method chaining
-
setParameterList
NativeQuery<T> setParameterList(int position, Object[] values)
Description copied from interface:Query
Bind multiple arguments to an ordinal query parameter.The "type mapping" for the binding is inferred from the type of the first collection element.
- Specified by:
setParameterList
in interfaceCommonQueryContract
- Specified by:
setParameterList
in interfaceMutationQuery
- Specified by:
setParameterList
in interfaceQuery<T>
- Specified by:
setParameterList
in interfaceSelectionQuery<T>
- Returns:
this
, for method chaining
-
setParameterList
<P> NativeQuery<T> setParameterList(int position, P[] values, Class<P> javaType)
Description copied from interface:Query
Bind multiple arguments to an ordinal query parameter using the givenClass
reference to attempt to determine theBindableType
to use. If unable to determine an appropriateBindableType
,Query.setParameterList(String, Collection)
is used.- Specified by:
setParameterList
in interfaceCommonQueryContract
- Specified by:
setParameterList
in interfaceMutationQuery
- Specified by:
setParameterList
in interfaceQuery<T>
- Specified by:
setParameterList
in interfaceSelectionQuery<T>
- Returns:
this
, for method chaining- See Also:
Query.setParameterList(int, Object[], BindableType)
-
setParameterList
<P> NativeQuery<T> setParameterList(int position, P[] values, BindableType<P> javaType)
Description copied from interface:Query
Bind multiple arguments to an ordinal query parameter using the givenBindableType
.- Specified by:
setParameterList
in interfaceCommonQueryContract
- Specified by:
setParameterList
in interfaceMutationQuery
- Specified by:
setParameterList
in interfaceQuery<T>
- Specified by:
setParameterList
in interfaceSelectionQuery<T>
- Returns:
this
, for method chaining
-
setParameterList
<P> NativeQuery<T> setParameterList(QueryParameter<P> parameter, Collection<? extends P> values)
Description copied from interface:Query
Bind multiple arguments to the query parameter represented by the givenQueryParameter
.The type of the parameter is inferred from the context in which it occurs, and from the type of the first given argument.
- Specified by:
setParameterList
in interfaceCommonQueryContract
- Specified by:
setParameterList
in interfaceMutationQuery
- Specified by:
setParameterList
in interfaceQuery<T>
- Specified by:
setParameterList
in interfaceSelectionQuery<T>
- Parameters:
parameter
- the parameter mementovalues
- a collection of arguments- Returns:
this
, for method chaining
-
setParameterList
<P> NativeQuery<T> setParameterList(QueryParameter<P> parameter, Collection<? extends P> values, Class<P> javaType)
Description copied from interface:Query
Bind multiple arguments to the query parameter represented by the givenQueryParameter
using the given Class reference to attempt to determine theBindableType
to use. If unable to determine an appropriateBindableType
,Query.setParameterList(String, Collection)
is used.- Specified by:
setParameterList
in interfaceCommonQueryContract
- Specified by:
setParameterList
in interfaceMutationQuery
- Specified by:
setParameterList
in interfaceQuery<T>
- Specified by:
setParameterList
in interfaceSelectionQuery<T>
- Returns:
this
, for method chaining- See Also:
Query.setParameterList(QueryParameter, java.util.Collection, BindableType)
-
setParameterList
<P> NativeQuery<T> setParameterList(QueryParameter<P> parameter, Collection<? extends P> values, BindableType<P> type)
Description copied from interface:Query
Bind multiple arguments to the query parameter represented by the givenQueryParameter
, inferring theBindableType
.The "type mapping" for the binding is inferred from the type of the first collection element.
- Specified by:
setParameterList
in interfaceCommonQueryContract
- Specified by:
setParameterList
in interfaceMutationQuery
- Specified by:
setParameterList
in interfaceQuery<T>
- Specified by:
setParameterList
in interfaceSelectionQuery<T>
- Returns:
this
, for method chaining
-
setParameterList
<P> NativeQuery<T> setParameterList(QueryParameter<P> parameter, P[] values)
Description copied from interface:Query
Bind multiple arguments to the query parameter represented by the givenQueryParameter
.The type of the parameter is inferred between the context in which it occurs, the type associated with the QueryParameter and the type of the first given argument.
- Specified by:
setParameterList
in interfaceCommonQueryContract
- Specified by:
setParameterList
in interfaceMutationQuery
- Specified by:
setParameterList
in interfaceQuery<T>
- Specified by:
setParameterList
in interfaceSelectionQuery<T>
- Parameters:
parameter
- the parameter mementovalues
- a collection of arguments- Returns:
this
, for method chaining
-
setParameterList
<P> NativeQuery<T> setParameterList(QueryParameter<P> parameter, P[] values, Class<P> javaType)
Description copied from interface:Query
Bind multiple arguments to the query parameter represented by the givenQueryParameter
using the givenClass
reference to attempt to determine theBindableType
to use. If unable to determine an appropriateBindableType
,Query.setParameterList(String, Collection)
is used.- Specified by:
setParameterList
in interfaceCommonQueryContract
- Specified by:
setParameterList
in interfaceMutationQuery
- Specified by:
setParameterList
in interfaceQuery<T>
- Specified by:
setParameterList
in interfaceSelectionQuery<T>
- Returns:
this
, for method chaining- See Also:
Query.setParameterList(QueryParameter, Object[], BindableType)
-
setParameterList
<P> NativeQuery<T> setParameterList(QueryParameter<P> parameter, P[] values, BindableType<P> type)
Description copied from interface:Query
Bind multiple arguments to the query parameter represented by the givenQueryParameter
, inferring theBindableType
.The "type mapping" for the binding is inferred from the type of the first collection element
- Specified by:
setParameterList
in interfaceCommonQueryContract
- Specified by:
setParameterList
in interfaceMutationQuery
- Specified by:
setParameterList
in interfaceQuery<T>
- Specified by:
setParameterList
in interfaceSelectionQuery<T>
- Returns:
this
, for method chaining
-
setProperties
NativeQuery<T> setProperties(Object bean)
Description copied from interface:Query
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.- Specified by:
setProperties
in interfaceCommonQueryContract
- Specified by:
setProperties
in interfaceMutationQuery
- Specified by:
setProperties
in interfaceQuery<T>
- Specified by:
setProperties
in interfaceSelectionQuery<T>
- Parameters:
bean
- any JavaBean or POJO- Returns:
this
, for method chaining
-
setProperties
NativeQuery<T> setProperties(Map bean)
Description copied from interface:Query
Bind the values of the givenMap
for each named parameters of the query, matching key names with parameter names and mapping value types to Hibernate types using heuristics.- Specified by:
setProperties
in interfaceCommonQueryContract
- Specified by:
setProperties
in interfaceMutationQuery
- Specified by:
setProperties
in interfaceQuery<T>
- Specified by:
setProperties
in interfaceSelectionQuery<T>
- Parameters:
bean
- aMap
of names to arguments- Returns:
this
, for method chaining
-
-