Interface NativeQuery<T>
- All Superinterfaces:
CommonQueryContract, MutationQuery, Query, Query<T>, SelectionQuery<T>, Statement, SynchronizeableQuery, TypedQuery<T>
- All Known Subinterfaces:
NativeQueryImplementor<R>
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 the Session
by calling:
SharedSessionContract.createNativeQuery(String, Class), passing native SQL as a string, orSharedSessionContract.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
SqlResultSetMappingpassed toSharedSessionContract.createNativeQuery(String, String, Class), - a named
SqlResultSetMappingspecified usingNamedNativeQuery.resultSetMapping()for a named query, or - by calling the various
addEntity(String),addRoot(String, String),addJoin(String, String),addFetch(String, String, String)andaddScalar(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(Class),addSynchronizedEntityName(String), oraddSynchronizedQuerySpace(String).
When the affected tables are not known to Hibernate, the behavior depends on whether Hibernate is operating in fully JPA-compliant mode.
- In JPA-compliant mode,
FlushModeType.AUTOspecifies that the session should be flushed before execution of a native query when the affected tables are not known. - Otherwise, when Hibernate is not operating in JPA-compliant mode,
AUTOspecifies that the session is not flushed before execution of a native query, unless the affected tables are known and Hibernate determines that a flush is required.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceAllows access to further control how collection returns are mapped back from result sets.static interfaceAllows access to further control how join fetch returns are mapped back from result sets.static interfacestatic interfaceSimple unification interface for all returns from the variousaddXYZ()methods.static interfaceANativeQuery.ResultNodewhich can be a query result.static interfaceAllows access to further control how properties within a root or join fetch are mapped back from the result set.static interfaceAllows access to further control how root returns are mapped back from result sets. -
Method Summary
Modifier and TypeMethodDescriptionaddAttributeResult(String columnAlias, SingularAttribute attribute) Deprecated.Use ResultSetMapping, or similar approach pending the outcome of this Jakarta Persistence request.addAttributeResult(String columnAlias, Class entityJavaType, String attributePath) Deprecated.Use ResultSetMapping, or similar approach pending the outcome of this Jakarta Persistence request.addAttributeResult(String columnAlias, String entityName, String attributePath) Deprecated.Use ResultSetMapping, or similar approach pending the outcome of this Jakarta Persistence request.Deprecated.Use ResultSetMapping, or similar approach pending the outcome of this Jakarta Persistence request.Deprecated.Use ResultSetMapping, or similar approach pending the outcome of this Jakarta Persistence request.Deprecated.Use ResultSetMapping, or similar approach pending the outcome of this Jakarta Persistence request.Deprecated.Use ResultSetMapping, or similar approach pending the outcome of this Jakarta Persistence request.Deprecated.Use ResultSetMapping, or similar approach pending the outcome of this Jakarta Persistence request.Deprecated.Use ResultSetMapping, or similar approach pending the outcome of this Jakarta Persistence request.Deprecated.Use ResultSetMapping, or similar approach pending the outcome of this Jakarta Persistence request.addInstantiation(Class<J> targetJavaType) Deprecated.Use ResultSetMapping, or similar approach pending the outcome of this Jakarta Persistence request.Deprecated.Use ResultSetMapping, or similar approach pending the outcome of this Jakarta Persistence request.Deprecated.Use ResultSetMapping, or similar approach pending the outcome of this Jakarta Persistence request.Deprecated.Use ResultSetMapping, or similar approach pending the outcome of this Jakarta Persistence request.addQueryHint(String hint) Add a database query hint to the SQL query.Deprecated.Use ResultSetMapping, or similar approach pending the outcome of this Jakarta Persistence request.Deprecated.Use ResultSetMapping, or similar approach pending the outcome of this Jakarta Persistence request.Deprecated.Use ResultSetMapping, or similar approach pending the outcome of this Jakarta Persistence request.Deprecated.Use ResultSetMapping, or similar approach pending the outcome of this Jakarta Persistence request.<C> NativeQuery<T> addScalar(String columnAlias, Class<C> relationalJavaType, AttributeConverter<?, C> converter) Deprecated.Use ResultSetMapping, or similar approach pending the outcome of this Jakarta Persistence request.<C> NativeQuery<T> addScalar(String columnAlias, Class<C> relationalJavaType, Class<? extends AttributeConverter<?, C>> converter) Deprecated.Use ResultSetMapping, or similar approach pending the outcome of this Jakarta Persistence request.<O,R> NativeQuery <T> addScalar(String columnAlias, Class<O> domainJavaType, Class<R> jdbcJavaType, AttributeConverter<O, R> converter) Deprecated.Use ResultSetMapping, or similar approach pending the outcome of this Jakarta Persistence request.<O,R> NativeQuery <T> addScalar(String columnAlias, Class<O> domainJavaType, Class<R> jdbcJavaType, Class<? extends AttributeConverter<O, R>> converter) Deprecated.Use ResultSetMapping, or similar approach pending the outcome of this Jakarta Persistence request.addScalar(String columnAlias, BasicDomainType type) Deprecated.Use ResultSetMapping, or similar approach pending the outcome of this Jakarta Persistence request.addScalar(String columnAlias, BasicTypeReference type) Deprecated.Use ResultSetMapping, or similar approach pending the outcome of this Jakarta Persistence request.addSynchronizedEntityClass(Class entityClass) Add all query spaces associated with the entity with the given type.addSynchronizedEntityName(String entityName) Add all query spaces associated with the entity with the given names.addSynchronizedQuerySpace(String querySpace) Add a query space.Get the rootLockModefor the queryNot applicable to native SQL queries, due to an unfortunate requirement of the JPA specification.setCacheable(boolean cacheable) Enable/disable second level query (result) caching for this query.setCacheMode(CacheMode cacheMode) Set the currentCacheModein effect for this query.setCacheRegion(String cacheRegion) Set the name of the cache region where query results should be cached (assumingSelectionQuery.isCacheable()).setCacheRetrieveMode(CacheRetrieveMode cacheRetrieveMode) setCacheStoreMode(CacheStoreMode cacheStoreMode) setComment(String comment) Set the comment for this query.<P> NativeQuery<T> setConvertedParameter(int position, P value, Class<? extends AttributeConverter<P, ?>> converter) <P> NativeQuery<T> setConvertedParameter(String name, P value, Class<? extends AttributeConverter<P, ?>> converter) setFetchSize(int fetchSize) Sets a JDBC fetch size hint for the query.setFirstResult(int startPosition) setFlushMode(FlushModeType flushMode) Deprecated.setHibernateLockMode(LockMode lockMode) Specify the rootLockModefor the querySet a hint.setLockMode(LockModeType lockMode) Not applicable to native SQL queries, due to an unfortunate requirement of the JPA specification.setLockScope(PessimisticLockScope lockScope) Apply a scope to any pessimistic locking applied to the query.setMaxResults(int maxResults) setParameter(int position, Object value) Bind the given argument to an ordinal query parameter.setParameter(int position, Instant value, TemporalType temporalType) Deprecated.setParameter(int position, Calendar value, TemporalType temporalType) Deprecated.setParameter(int position, Date value, TemporalType temporalType) Deprecated.<P> NativeQuery<T> setParameter(int position, P val, Type<P> type) Bind the given argument to an ordinal query parameter using the givenType.<P> NativeQuery<T> setParameter(int position, P val, Class<P> type) setParameter(Parameter<Calendar> param, Calendar value, TemporalType temporalType) Deprecated.setParameter(Parameter<Date> param, Date value, TemporalType temporalType) Deprecated.<P> NativeQuery<T> setParameter(Parameter<P> param, P value) setParameter(String name, Object value) Bind the given argument to a named query parameter.setParameter(String name, Instant value, TemporalType temporalType) Deprecated.setParameter(String name, Calendar value, TemporalType temporalType) Deprecated.setParameter(String name, Date value, TemporalType temporalType) Deprecated.<P> NativeQuery<T> setParameter(String name, P val, Type<P> type) Bind the given argument to a named query parameter using the givenType.<P> NativeQuery<T> setParameter(String name, P val, Class<P> type) <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, Type<P> type) Bind an argument to the query parameter represented by the givenQueryParameter, using the givenType.<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 givenClassreference to attempt to infer theTypeto use.setParameterList(int position, Object[] values) Bind multiple arguments to an ordinal query parameter.setParameterList(int position, Collection values) Bind multiple arguments to an ordinal query parameter.<P> NativeQuery<T> setParameterList(int position, Collection<? extends P> values, Type<P> javaType) Bind multiple arguments to an ordinal query parameter using the givenType.<P> NativeQuery<T> setParameterList(int position, Collection<? extends P> values, Class<P> type) <P> NativeQuery<T> setParameterList(int position, P[] values, Type<P> javaType) Bind multiple arguments to an ordinal query parameter using the givenType.<P> NativeQuery<T> setParameterList(int position, P[] values, Class<P> javaType) setParameterList(String name, Object[] values) Bind multiple arguments to a named query parameter.setParameterList(String name, Collection values) Bind multiple arguments to a named query parameter.<P> NativeQuery<T> setParameterList(String name, Collection<? extends P> values, Type<P> type) Bind multiple arguments to a named query parameter using the givenType.<P> NativeQuery<T> setParameterList(String name, Collection<? extends P> values, Class<P> type) Bind multiple arguments to a named query parameter using the givenClassreference to attempt to infer theTypeIf unable to infer an appropriateType, fall back toCommonQueryContract.setParameterList(String, Collection).<P> NativeQuery<T> setParameterList(String name, P[] values, Type<P> type) Bind multiple arguments to a named query parameter using the givenType.<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 theTypeto use.<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, Type<P> type) Bind multiple arguments to the query parameter represented by the givenQueryParameter, using the givenType.<P> NativeQuery<T> setParameterList(QueryParameter<P> parameter, Collection<? extends P> values, Class<P> javaType) Bind multiple arguments to the query parameter represented by the givenQueryParameterusing the givenClassreference to attempt to infer theTypeto use.<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, Type<P> type) Bind multiple arguments to the query parameter represented by the givenQueryParameter, using the given theType.<P> NativeQuery<T> setParameterList(QueryParameter<P> parameter, P[] values, Class<P> javaType) Bind multiple arguments to the query parameter represented by the givenQueryParameterusing the givenClassreference to attempt to infer theTypeto use.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.setProperties(Map bean) Bind the values of the givenMapto named parameters of the query, matching key names with parameter names and mapping value types to Hibernate types using heuristics.setQueryFlushMode(QueryFlushMode queryFlushMode) Set theQueryFlushModeto use for this query.setQueryPlanCacheable(boolean queryPlanCacheable) Enable/disable query plan caching for this query.setReadOnly(boolean readOnly) Set the read-only/modifiable mode for entities and proxies loaded by thisQuery.setResultListTransformer(ResultListTransformer<T> transformer) Set aResultListTransformer.setTimeout(int timeout) Apply a timeout to the corresponding database query.setTimeout(Timeout timeout) Apply a timeout to the corresponding database query.setTimeout(Integer timeout) Apply a timeout to the corresponding database query.<X> SelectionQuery<X> setTupleTransformer(TupleTransformer<X> transformer) Set aTupleTransformer.Methods inherited from interface CommonQueryContract
asMutationQuery, asSelectionQuery, asSelectionQuery, asSelectionQuery, getComment, getEffectiveFlushMode, getParameterMetadata, getQueryFlushMode, getSession, getTimeoutMethods inherited from interface MutationQuery
executeUpdate, getMutationString, getTargetTypeMethods inherited from interface Query
getHints, getParameter, getParameter, getParameter, getParameter, getParameters, getParameterValue, getParameterValue, getParameterValue, isBound, unwrapMethods inherited from interface Query
asSelectionQuery, asStatement, executeUpdate, getFlushMode, getLockTimeout, getQueryOptions, getQueryString, ofType, setFollowOnLockingStrategy, withEntityGraphMethods inherited from interface SelectionQuery
disableFetchProfile, enableFetchProfile, getCacheMode, getCacheRegion, getCacheRetrieveMode, getCacheStoreMode, getFetchSize, getKeyedResultList, getResultCount, getResultList, getResultStream, getResultType, getSingleResult, getSingleResultOrNull, isCacheable, isQueryPlanCacheable, isReadOnly, list, scroll, scroll, setEntityGraph, setEntityGraph, setFollowOnStrategy, setLockTimeout, setPage, stream, uniqueResult, uniqueResultOptionalMethods inherited from interface SynchronizeableQuery
getSynchronizedQuerySpacesMethods inherited from interface TypedQuery
executeUpdate, getEntityGraph, getFirstResult, getLockScope, getMaxResults
-
Method Details
-
addSynchronizedQuerySpace
Description copied from interface:SynchronizeableQueryAdd 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:
addSynchronizedQuerySpacein interfaceSynchronizeableQuery- Parameters:
querySpace- The name of the query space, usually the name of a database table.- Returns:
this, for method chaining
-
addSynchronizedEntityName
Description copied from interface:SynchronizeableQueryAdd all query spaces associated with the entity with the given names.Same as
SynchronizeableQuery.addSynchronizedQuerySpace(String)for all tables mapped by the given entity.- Specified by:
addSynchronizedEntityNamein 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
Description copied from interface:SynchronizeableQueryAdd all query spaces associated with the entity with the given type.Same as
SynchronizeableQuery.addSynchronizedQuerySpace(String)for all tables mapped by the given entity.- Specified by:
addSynchronizedEntityClassin 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
-
setTimeout
Description copied from interface:QueryApply a timeout to the corresponding database query.- Specified by:
setTimeoutin interfaceCommonQueryContract- Specified by:
setTimeoutin interfaceMutationQuery- Specified by:
setTimeoutin interfaceQuery- Specified by:
setTimeoutin interfaceQuery<T>- Specified by:
setTimeoutin interfaceSelectionQuery<T>- Specified by:
setTimeoutin interfaceStatement- Specified by:
setTimeoutin interfaceTypedQuery<T>- See Also:
-
setQueryPlanCacheable
Description copied from interface:SelectionQueryEnable/disable query plan caching for this query.- Specified by:
setQueryPlanCacheablein interfaceQuery<T>- Specified by:
setQueryPlanCacheablein interfaceSelectionQuery<T>- See Also:
-
setQueryFlushMode
Description copied from interface:CommonQueryContractSet theQueryFlushModeto use for this query.- Specified by:
setQueryFlushModein interfaceCommonQueryContract- Specified by:
setQueryFlushModein interfaceMutationQuery- Specified by:
setQueryFlushModein interfaceQuery<T>- Specified by:
setQueryFlushModein interfaceSelectionQuery<T>- See Also:
-
setFlushMode
Deprecated.Description copied from interface:QuerySet theFlushModeTypeto use for this query.Setting this to
nullultimately indicates to use theFlushModeof the session. UseQuery.setQueryFlushMode(QueryFlushMode)passingQueryFlushMode.NO_FLUSHinstead to indicate that no automatic flushing should occur.- Specified by:
setFlushModein interfaceMutationQuery- Specified by:
setFlushModein interfaceQuery- Specified by:
setFlushModein interfaceQuery<T>- Specified by:
setFlushModein interfaceSelectionQuery<T>- Specified by:
setFlushModein interfaceStatement- Specified by:
setFlushModein interfaceTypedQuery<T>- See Also:
-
setCacheMode
Description copied from interface:SelectionQuerySet the currentCacheModein effect for this query.Set it to
nullto indicate that theCacheModeof thesessionshould be used.- Specified by:
setCacheModein interfaceQuery<T>- Specified by:
setCacheModein interfaceSelectionQuery<T>- See Also:
-
setCacheStoreMode
- Specified by:
setCacheStoreModein interfaceQuery- Specified by:
setCacheStoreModein interfaceQuery<T>- Specified by:
setCacheStoreModein interfaceSelectionQuery<T>- Specified by:
setCacheStoreModein interfaceTypedQuery<T>- See Also:
-
setCacheRetrieveMode
- Specified by:
setCacheRetrieveModein interfaceQuery- Specified by:
setCacheRetrieveModein interfaceQuery<T>- Specified by:
setCacheRetrieveModein interfaceSelectionQuery<T>- Specified by:
setCacheRetrieveModein interfaceTypedQuery<T>- See Also:
-
setCacheable
Description copied from interface:SelectionQueryEnable/disable second level query (result) caching for this query.- Specified by:
setCacheablein interfaceQuery<T>- Specified by:
setCacheablein interfaceSelectionQuery<T>- See Also:
-
setCacheRegion
Description copied from interface:SelectionQuerySet the name of the cache region where query results should be cached (assumingSelectionQuery.isCacheable()).nullindicates to use the default region.- Specified by:
setCacheRegionin interfaceQuery<T>- Specified by:
setCacheRegionin interfaceSelectionQuery<T>- See Also:
-
setTimeout
Description copied from interface:QueryApply a timeout to the corresponding database query.- Specified by:
setTimeoutin interfaceCommonQueryContract- Specified by:
setTimeoutin interfaceMutationQuery- Specified by:
setTimeoutin interfaceQuery<T>- Specified by:
setTimeoutin interfaceSelectionQuery<T>- See Also:
-
setFetchSize
Description copied from interface:SelectionQuerySets a JDBC fetch size hint for the query.- Specified by:
setFetchSizein interfaceQuery<T>- Specified by:
setFetchSizein interfaceSelectionQuery<T>- Parameters:
fetchSize- the fetch size hint- Returns:
this, for method chaining- See Also:
-
setReadOnly
Description copied from interface:SelectionQuerySet 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:
setReadOnlyin interfaceQuery<T>- Specified by:
setReadOnlyin interfaceSelectionQuery<T>- Parameters:
readOnly-trueindicates that entities and proxies loaded by the query are to be put in read-only mode;falseindicates that entities and proxies loaded by the query will be put in modifiable mode- Returns:
this, for method chaining
-
setComment
Description copied from interface:QuerySet 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:
setCommentin interfaceCommonQueryContract- Specified by:
setCommentin interfaceMutationQuery- Specified by:
setCommentin interfaceQuery<T>- Specified by:
setCommentin interfaceSelectionQuery<T>- See Also:
-
addQueryHint
Description copied from interface:QueryAdd a database query hint to the SQL query.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:
addQueryHintin interfaceCommonQueryContract- Specified by:
addQueryHintin interfaceQuery<T>
-
setMaxResults
Description copied from interface:SelectionQuery- Specified by:
setMaxResultsin interfaceQuery- Specified by:
setMaxResultsin interfaceQuery<T>- Specified by:
setMaxResultsin interfaceSelectionQuery<T>- Specified by:
setMaxResultsin interfaceTypedQuery<T>
-
setFirstResult
Description copied from interface:SelectionQuery- Specified by:
setFirstResultin interfaceQuery- Specified by:
setFirstResultin interfaceQuery<T>- Specified by:
setFirstResultin interfaceSelectionQuery<T>- Specified by:
setFirstResultin interfaceTypedQuery<T>
-
setHint
Description copied from interface:QuerySet a hint. Hints are a JPA-standard way to control provider-specific behavior affecting execution of the query. Clients of native Hibernate API should make use of type-safe operations of this interface and of its subtypes. For example,SelectionQuery.setCacheRegion(String)is preferred overHibernateHints.HINT_CACHE_REGION.The hints understood by Hibernate are enumerated by
AvailableHints.- Specified by:
setHintin interfaceCommonQueryContract- Specified by:
setHintin interfaceMutationQuery- Specified by:
setHintin interfaceQuery- Specified by:
setHintin interfaceQuery<T>- Specified by:
setHintin interfaceSelectionQuery<T>- Specified by:
setHintin interfaceStatement- Specified by:
setHintin interfaceTypedQuery<T>- See Also:
-
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:
getLockModein interfaceQuery- Specified by:
getLockModein interfaceSelectionQuery<T>- Specified by:
getLockModein interfaceTypedQuery<T>- Throws:
IllegalStateException- as required by JPA- See Also:
-
getHibernateLockMode
LockMode getHibernateLockMode()Description copied from interface:SelectionQueryGet the rootLockModefor the query- Specified by:
getHibernateLockModein interfaceQuery<T>- Specified by:
getHibernateLockModein interfaceSelectionQuery<T>- See Also:
-
setLockMode
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:
setLockModein interfaceQuery- Specified by:
setLockModein interfaceQuery<T>- Specified by:
setLockModein interfaceSelectionQuery<T>- Specified by:
setLockModein interfaceTypedQuery<T>- Throws:
IllegalStateException- as required by JPA- See Also:
-
setHibernateLockMode
Description copied from interface:SelectionQuerySpecify the rootLockModefor the query- Specified by:
setHibernateLockModein interfaceQuery<T>- Specified by:
setHibernateLockModein interfaceSelectionQuery<T>- See Also:
-
setTimeout
Apply a timeout to the corresponding database query.- Specified by:
setTimeoutin interfaceCommonQueryContract- Specified by:
setTimeoutin interfaceMutationQuery- Specified by:
setTimeoutin interfaceQuery- Specified by:
setTimeoutin interfaceQuery<T>- Specified by:
setTimeoutin interfaceSelectionQuery<T>- Specified by:
setTimeoutin interfaceStatement- Specified by:
setTimeoutin interfaceTypedQuery<T>- Parameters:
timeout- The timeout to apply- Returns:
this, for method chaining
-
setLockScope
Apply a scope to any pessimistic locking applied to the query.- Specified by:
setLockScopein interfaceQuery<T>- Specified by:
setLockScopein interfaceSelectionQuery<T>- Specified by:
setLockScopein interfaceTypedQuery<T>- Parameters:
lockScope- The lock scope to apply- Returns:
this, for method chaining
-
setTupleTransformer
Description copied from interface:SelectionQuerySet aTupleTransformer.- Specified by:
setTupleTransformerin interfaceQuery<T>- Specified by:
setTupleTransformerin interfaceSelectionQuery<T>
-
setResultListTransformer
Description copied from interface:SelectionQuerySet aResultListTransformer.- Specified by:
setResultListTransformerin interfaceQuery<T>- Specified by:
setResultListTransformerin interfaceSelectionQuery<T>
-
setParameter
Description copied from interface:QueryBind 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 overloads which accepts a "type", or pass a
TypedParameterValue.- Specified by:
setParameterin interfaceCommonQueryContract- Specified by:
setParameterin interfaceMutationQuery- Specified by:
setParameterin interfaceQuery- Specified by:
setParameterin interfaceQuery<T>- Specified by:
setParameterin interfaceSelectionQuery<T>- Specified by:
setParameterin interfaceStatement- Specified by:
setParameterin interfaceTypedQuery<T>- See Also:
-
setParameter
Description copied from interface:QueryBind the given argument to a named query parameter using the givenClassreference to attempt to infer theType. If unable to infer an appropriateType, fall back toCommonQueryContract.setParameter(String, Object).- Specified by:
setParameterin interfaceCommonQueryContract- Specified by:
setParameterin interfaceMutationQuery- Specified by:
setParameterin interfaceQuery- Specified by:
setParameterin interfaceQuery<T>- Specified by:
setParameterin interfaceSelectionQuery<T>- Specified by:
setParameterin interfaceStatement- Specified by:
setParameterin interfaceTypedQuery<T>- See Also:
-
setParameter
Description copied from interface:QueryBind the given argument to a named query parameter using the givenType.- Specified by:
setParameterin interfaceCommonQueryContract- Specified by:
setParameterin interfaceMutationQuery- Specified by:
setParameterin interfaceQuery- Specified by:
setParameterin interfaceQuery<T>- Specified by:
setParameterin interfaceSelectionQuery<T>- Specified by:
setParameterin interfaceStatement- Specified by:
setParameterin interfaceTypedQuery<T>
-
setParameter
@Deprecated(since="7") NativeQuery<T> setParameter(String name, Instant value, TemporalType temporalType) Deprecated.Description copied from interface:QueryBind anInstantvalue to the named Queryparameter using just the portion indicated by the given TemporalType.- Specified by:
setParameterin interfaceCommonQueryContract- Specified by:
setParameterin interfaceMutationQuery- Specified by:
setParameterin interfaceQuery<T>- Specified by:
setParameterin interfaceSelectionQuery<T>
-
setParameter
@Deprecated(since="7") NativeQuery<T> setParameter(String name, Calendar value, TemporalType temporalType) Deprecated.Description copied from interface:QueryQueryoverride- Specified by:
setParameterin interfaceCommonQueryContract- Specified by:
setParameterin interfaceMutationQuery- Specified by:
setParameterin interfaceQuery- Specified by:
setParameterin interfaceQuery<T>- Specified by:
setParameterin interfaceSelectionQuery<T>- Specified by:
setParameterin interfaceStatement- Specified by:
setParameterin interfaceTypedQuery<T>- See Also:
-
setParameter
@Deprecated(since="7") NativeQuery<T> setParameter(String name, Date value, TemporalType temporalType) Deprecated.Description copied from interface:QueryQueryoverride- Specified by:
setParameterin interfaceCommonQueryContract- Specified by:
setParameterin interfaceMutationQuery- Specified by:
setParameterin interfaceQuery- Specified by:
setParameterin interfaceQuery<T>- Specified by:
setParameterin interfaceSelectionQuery<T>- Specified by:
setParameterin interfaceStatement- Specified by:
setParameterin interfaceTypedQuery<T>- See Also:
-
setParameter
Description copied from interface:QueryBind 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 overloads which accepts a "type", or pass a
TypedParameterValue.- Specified by:
setParameterin interfaceCommonQueryContract- Specified by:
setParameterin interfaceMutationQuery- Specified by:
setParameterin interfaceQuery- Specified by:
setParameterin interfaceQuery<T>- Specified by:
setParameterin interfaceSelectionQuery<T>- Specified by:
setParameterin interfaceStatement- Specified by:
setParameterin interfaceTypedQuery<T>- See Also:
-
setParameter
Description copied from interface:QueryBind the given argument to an ordinal query parameter using the givenClassreference to attempt to infer theType. If unable to infer an appropriateType, fall back toCommonQueryContract.setParameter(int, Object).- Specified by:
setParameterin interfaceCommonQueryContract- Specified by:
setParameterin interfaceMutationQuery- Specified by:
setParameterin interfaceQuery- Specified by:
setParameterin interfaceQuery<T>- Specified by:
setParameterin interfaceSelectionQuery<T>- Specified by:
setParameterin interfaceStatement- Specified by:
setParameterin interfaceTypedQuery<T>- See Also:
-
setParameter
Description copied from interface:QueryBind the given argument to an ordinal query parameter using the givenType.- Specified by:
setParameterin interfaceCommonQueryContract- Specified by:
setParameterin interfaceMutationQuery- Specified by:
setParameterin interfaceQuery- Specified by:
setParameterin interfaceQuery<T>- Specified by:
setParameterin interfaceSelectionQuery<T>- Specified by:
setParameterin interfaceStatement- Specified by:
setParameterin interfaceTypedQuery<T>
-
setParameter
@Deprecated(since="7") NativeQuery<T> setParameter(int position, Instant value, TemporalType temporalType) Deprecated.Description copied from interface:QueryBind anInstantvalue to the ordinal Queryparameter using just the portion indicated by the given TemporalType.- Specified by:
setParameterin interfaceCommonQueryContract- Specified by:
setParameterin interfaceMutationQuery- Specified by:
setParameterin interfaceQuery<T>- Specified by:
setParameterin interfaceSelectionQuery<T>
-
setParameter
@Deprecated(since="7") NativeQuery<T> setParameter(int position, Calendar value, TemporalType temporalType) Deprecated.Description copied from interface:QueryQueryoverride- Specified by:
setParameterin interfaceCommonQueryContract- Specified by:
setParameterin interfaceMutationQuery- Specified by:
setParameterin interfaceQuery- Specified by:
setParameterin interfaceQuery<T>- Specified by:
setParameterin interfaceSelectionQuery<T>- Specified by:
setParameterin interfaceStatement- Specified by:
setParameterin interfaceTypedQuery<T>- See Also:
-
setParameter
@Deprecated(since="7") NativeQuery<T> setParameter(int position, Date value, TemporalType temporalType) Deprecated.Description copied from interface:QueryQueryoverride- Specified by:
setParameterin interfaceCommonQueryContract- Specified by:
setParameterin interfaceMutationQuery- Specified by:
setParameterin interfaceQuery- Specified by:
setParameterin interfaceQuery<T>- Specified by:
setParameterin interfaceSelectionQuery<T>- Specified by:
setParameterin interfaceStatement- Specified by:
setParameterin interfaceTypedQuery<T>- See Also:
-
setParameter
Description copied from interface:QueryBind 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 overloads which accepts a "type".
- Specified by:
setParameterin interfaceCommonQueryContract- Specified by:
setParameterin interfaceMutationQuery- Specified by:
setParameterin interfaceQuery<T>- Specified by:
setParameterin interfaceSelectionQuery<T>- Parameters:
parameter- the query parameter mementoval- the argument, which might be null- Returns:
this, for method chaining- See Also:
-
setParameter
Description copied from interface:QueryBind an argument to the query parameter represented by the givenQueryParameter, using the givenClassreference to attempt to infer theTypeto use. If unable to infer an appropriateType, fall back toCommonQueryContract.setParameter(QueryParameter, Object).- Specified by:
setParameterin interfaceCommonQueryContract- Specified by:
setParameterin interfaceMutationQuery- Specified by:
setParameterin interfaceQuery<T>- Specified by:
setParameterin interfaceSelectionQuery<T>- Parameters:
parameter- the query parameter mementoval- the argument, which might be nulltype- aTyperepresenting the type of the parameter- Returns:
this, for method chaining- See Also:
-
setParameter
Description copied from interface:QueryBind an argument to the query parameter represented by the givenQueryParameter, using the givenType.- Specified by:
setParameterin interfaceCommonQueryContract- Specified by:
setParameterin interfaceMutationQuery- Specified by:
setParameterin interfaceQuery<T>- Specified by:
setParameterin interfaceSelectionQuery<T>- Parameters:
parameter- the query parameter mementoval- the argument, which might be nulltype- aTyperepresenting the type of the parameter- Returns:
this, for method chaining
-
setParameter
Description copied from interface:Query- Specified by:
setParameterin interfaceCommonQueryContract- Specified by:
setParameterin interfaceMutationQuery- Specified by:
setParameterin interfaceQuery- Specified by:
setParameterin interfaceQuery<T>- Specified by:
setParameterin interfaceSelectionQuery<T>- Specified by:
setParameterin interfaceStatement- Specified by:
setParameterin interfaceTypedQuery<T>- See Also:
-
setParameter
@Deprecated(since="7") NativeQuery<T> setParameter(Parameter<Calendar> param, Calendar value, TemporalType temporalType) Deprecated.Description copied from interface:QueryQueryoverride- Specified by:
setParameterin interfaceCommonQueryContract- Specified by:
setParameterin interfaceMutationQuery- Specified by:
setParameterin interfaceQuery- Specified by:
setParameterin interfaceQuery<T>- Specified by:
setParameterin interfaceSelectionQuery<T>- Specified by:
setParameterin interfaceStatement- Specified by:
setParameterin interfaceTypedQuery<T>- See Also:
-
setParameter
@Deprecated(since="7") NativeQuery<T> setParameter(Parameter<Date> param, Date value, TemporalType temporalType) Deprecated.Description copied from interface:QueryQueryoverride- Specified by:
setParameterin interfaceCommonQueryContract- Specified by:
setParameterin interfaceMutationQuery- Specified by:
setParameterin interfaceQuery- Specified by:
setParameterin interfaceQuery<T>- Specified by:
setParameterin interfaceSelectionQuery<T>- Specified by:
setParameterin interfaceStatement- Specified by:
setParameterin interfaceTypedQuery<T>- See Also:
-
setProperties
Description copied from interface:QueryBind 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:
setPropertiesin interfaceCommonQueryContract- Specified by:
setPropertiesin interfaceMutationQuery- Specified by:
setPropertiesin interfaceQuery<T>- Specified by:
setPropertiesin interfaceSelectionQuery<T>- Parameters:
bean- any JavaBean or POJO- Returns:
this, for method chaining
-
setProperties
Description copied from interface:QueryBind the values of the givenMapto named parameters of the query, matching key names with parameter names and mapping value types to Hibernate types using heuristics.- Specified by:
setPropertiesin interfaceCommonQueryContract- Specified by:
setPropertiesin interfaceMutationQuery- Specified by:
setPropertiesin interfaceQuery<T>- Specified by:
setPropertiesin interfaceSelectionQuery<T>- Parameters:
bean- aMapof names to arguments- Returns:
this, for method chaining
-
setConvertedParameter
<P> NativeQuery<T> setConvertedParameter(String name, P value, Class<? extends AttributeConverter<P, ?>> converter) Description copied from interface:Query- Specified by:
setConvertedParameterin interfaceCommonQueryContract- Specified by:
setConvertedParameterin interfaceMutationQuery- Specified by:
setConvertedParameterin interfaceQuery- Specified by:
setConvertedParameterin interfaceQuery<T>- Specified by:
setConvertedParameterin interfaceSelectionQuery<T>- Specified by:
setConvertedParameterin interfaceStatement- Specified by:
setConvertedParameterin interfaceTypedQuery<T>- See Also:
-
setConvertedParameter
<P> NativeQuery<T> setConvertedParameter(int position, P value, Class<? extends AttributeConverter<P, ?>> converter) Description copied from interface:Query- Specified by:
setConvertedParameterin interfaceCommonQueryContract- Specified by:
setConvertedParameterin interfaceMutationQuery- Specified by:
setConvertedParameterin interfaceQuery- Specified by:
setConvertedParameterin interfaceQuery<T>- Specified by:
setConvertedParameterin interfaceSelectionQuery<T>- Specified by:
setConvertedParameterin interfaceStatement- Specified by:
setConvertedParameterin interfaceTypedQuery<T>- See Also:
-
setParameterList
Description copied from interface:QueryBind 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:
setParameterListin interfaceCommonQueryContract- Specified by:
setParameterListin interfaceMutationQuery- Specified by:
setParameterListin interfaceQuery<T>- Specified by:
setParameterListin interfaceSelectionQuery<T>- Returns:
this, for method chaining- See Also:
-
setParameterList
Description copied from interface:QueryBind multiple arguments to a named query parameter using the givenClassreference to attempt to infer theTypeIf unable to infer an appropriateType, fall back toCommonQueryContract.setParameterList(String, Collection).- Specified by:
setParameterListin interfaceCommonQueryContract- Specified by:
setParameterListin interfaceMutationQuery- Specified by:
setParameterListin interfaceQuery<T>- Specified by:
setParameterListin interfaceSelectionQuery<T>- Returns:
this, for method chaining- See Also:
-
setParameterList
Description copied from interface:QueryBind multiple arguments to a named query parameter using the givenType.- Specified by:
setParameterListin interfaceCommonQueryContract- Specified by:
setParameterListin interfaceMutationQuery- Specified by:
setParameterListin interfaceQuery<T>- Specified by:
setParameterListin interfaceSelectionQuery<T>- Returns:
this, for method chaining
-
setParameterList
Description copied from interface:QueryBind 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:
setParameterListin interfaceCommonQueryContract- Specified by:
setParameterListin interfaceMutationQuery- Specified by:
setParameterListin interfaceQuery<T>- Specified by:
setParameterListin interfaceSelectionQuery<T>- Returns:
this, for method chaining
-
setParameterList
Description copied from interface:QueryBind multiple arguments to a named query parameter using the given Class reference to attempt to determine theTypeto use. If unable to determine an appropriateType,CommonQueryContract.setParameterList(String, Collection)is used- Specified by:
setParameterListin interfaceCommonQueryContract- Specified by:
setParameterListin interfaceMutationQuery- Specified by:
setParameterListin interfaceQuery<T>- Specified by:
setParameterListin interfaceSelectionQuery<T>- Returns:
this, for method chaining- See Also:
-
setParameterList
Description copied from interface:QueryBind multiple arguments to a named query parameter using the givenType.- Specified by:
setParameterListin interfaceCommonQueryContract- Specified by:
setParameterListin interfaceMutationQuery- Specified by:
setParameterListin interfaceQuery<T>- Specified by:
setParameterListin interfaceSelectionQuery<T>- Returns:
this, for method chaining
-
setParameterList
Description copied from interface:QueryBind 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:
setParameterListin interfaceCommonQueryContract- Specified by:
setParameterListin interfaceMutationQuery- Specified by:
setParameterListin interfaceQuery<T>- Specified by:
setParameterListin interfaceSelectionQuery<T>- Returns:
this, for method chaining
-
setParameterList
Description copied from interface:QueryBind multiple arguments to an ordinal query parameter using the givenClassreference to attempt to infer theType. If unable to infer an appropriateType, fall back toCommonQueryContract.setParameterList(String, Collection).- Specified by:
setParameterListin interfaceCommonQueryContract- Specified by:
setParameterListin interfaceMutationQuery- Specified by:
setParameterListin interfaceQuery<T>- Specified by:
setParameterListin interfaceSelectionQuery<T>- Returns:
this, for method chaining- See Also:
-
setParameterList
Description copied from interface:QueryBind multiple arguments to an ordinal query parameter using the givenType.- Specified by:
setParameterListin interfaceCommonQueryContract- Specified by:
setParameterListin interfaceMutationQuery- Specified by:
setParameterListin interfaceQuery<T>- Specified by:
setParameterListin interfaceSelectionQuery<T>- Returns:
this, for method chaining
-
setParameterList
Description copied from interface:QueryBind 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:
setParameterListin interfaceCommonQueryContract- Specified by:
setParameterListin interfaceMutationQuery- Specified by:
setParameterListin interfaceQuery<T>- Specified by:
setParameterListin interfaceSelectionQuery<T>- Returns:
this, for method chaining
-
setParameterList
Description copied from interface:QueryBind multiple arguments to an ordinal query parameter using the givenClassreference to attempt to infer theType. If unable to infer an appropriateType, fall back toCommonQueryContract.setParameterList(String, Collection).- Specified by:
setParameterListin interfaceCommonQueryContract- Specified by:
setParameterListin interfaceMutationQuery- Specified by:
setParameterListin interfaceQuery<T>- Specified by:
setParameterListin interfaceSelectionQuery<T>- Returns:
this, for method chaining- See Also:
-
setParameterList
Description copied from interface:QueryBind multiple arguments to an ordinal query parameter using the givenType.- Specified by:
setParameterListin interfaceCommonQueryContract- Specified by:
setParameterListin interfaceMutationQuery- Specified by:
setParameterListin interfaceQuery<T>- Specified by:
setParameterListin interfaceSelectionQuery<T>- Returns:
this, for method chaining
-
setParameterList
Description copied from interface:QueryBind 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:
setParameterListin interfaceCommonQueryContract- Specified by:
setParameterListin interfaceMutationQuery- Specified by:
setParameterListin interfaceQuery<T>- Specified by:
setParameterListin 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:QueryBind multiple arguments to the query parameter represented by the givenQueryParameterusing the givenClassreference to attempt to infer theTypeto use. If unable to infer an appropriateType, fall back to usingCommonQueryContract.setParameterList(String, Collection).- Specified by:
setParameterListin interfaceCommonQueryContract- Specified by:
setParameterListin interfaceMutationQuery- Specified by:
setParameterListin interfaceQuery<T>- Specified by:
setParameterListin interfaceSelectionQuery<T>- Returns:
this, for method chaining- See Also:
-
setParameterList
<P> NativeQuery<T> setParameterList(QueryParameter<P> parameter, Collection<? extends P> values, Type<P> type) Description copied from interface:QueryBind multiple arguments to the query parameter represented by the givenQueryParameter, using the givenType.- Specified by:
setParameterListin interfaceCommonQueryContract- Specified by:
setParameterListin interfaceMutationQuery- Specified by:
setParameterListin interfaceQuery<T>- Specified by:
setParameterListin interfaceSelectionQuery<T>- Returns:
this, for method chaining
-
setParameterList
Description copied from interface:QueryBind 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
QueryParameterand the type of the first given argument.- Specified by:
setParameterListin interfaceCommonQueryContract- Specified by:
setParameterListin interfaceMutationQuery- Specified by:
setParameterListin interfaceQuery<T>- Specified by:
setParameterListin interfaceSelectionQuery<T>- Parameters:
parameter- the parameter mementovalues- a collection of arguments- Returns:
this, for method chaining
-
setParameterList
Description copied from interface:QueryBind multiple arguments to the query parameter represented by the givenQueryParameterusing the givenClassreference to attempt to infer theTypeto use. If unable to infer an appropriateType, fall back to usingCommonQueryContract.setParameterList(String, Collection).- Specified by:
setParameterListin interfaceCommonQueryContract- Specified by:
setParameterListin interfaceMutationQuery- Specified by:
setParameterListin interfaceQuery<T>- Specified by:
setParameterListin interfaceSelectionQuery<T>- Returns:
this, for method chaining- See Also:
-
setParameterList
Description copied from interface:QueryBind multiple arguments to the query parameter represented by the givenQueryParameter, using the given theType.- Specified by:
setParameterListin interfaceCommonQueryContract- Specified by:
setParameterListin interfaceMutationQuery- Specified by:
setParameterListin interfaceQuery<T>- Specified by:
setParameterListin interfaceSelectionQuery<T>- Returns:
this, for method chaining
-
addScalar
Deprecated.Use ResultSetMapping, or similar approach pending the outcome of this Jakarta Persistence request.Declare a scalar query result. Hibernate will attempt to automatically detect the underlying type.Functions like
<return-scalar/>inhbm.xmlorColumnResultin annotations- Parameters:
columnAlias- The column alias in the result set to be processed as a scalar result- Returns:
this, for method chaining
-
addScalar
Deprecated.Use ResultSetMapping, or similar approach pending the outcome of this Jakarta Persistence request.Declare a scalar query result.Functions like
<return-scalar/>inhbm.xmlorColumnResultin 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
Deprecated.Use ResultSetMapping, or similar approach pending the outcome of this Jakarta Persistence request.Declare a scalar query result.Functions like
<return-scalar/>inhbm.xmlorColumnResultin 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
Deprecated.Use ResultSetMapping, or similar approach pending the outcome of this Jakarta Persistence request.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
@Deprecated(since="8.0") <C> NativeQuery<T> addScalar(String columnAlias, Class<C> relationalJavaType, AttributeConverter<?, C> converter) Deprecated.Use ResultSetMapping, or similar approach pending the outcome of this Jakarta Persistence request.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
@Deprecated(since="8.0") <O,R> NativeQuery<T> addScalar(String columnAlias, Class<O> domainJavaType, Class<R> jdbcJavaType, AttributeConverter<O, R> converter) Deprecated.Use ResultSetMapping, or similar approach pending the outcome of this Jakarta Persistence request.Declare a scalar query result with an explicit conversion.- Parameters:
domainJavaType- The Java type expected by the converter as its "object model" type.jdbcJavaType- The Java type expected by the converter as its "relational model" type.converter- The conversion to apply. Consumes the JDBC value based onrelationalJavaType.- Returns:
this, for method chaining- Since:
- 6.0
-
addScalar
@Deprecated(since="8.0") <C> NativeQuery<T> addScalar(String columnAlias, Class<C> relationalJavaType, Class<? extends AttributeConverter<?, C>> converter) Deprecated.Use ResultSetMapping, or similar approach pending the outcome of this Jakarta Persistence request.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
@Deprecated(since="8.0") <O,R> NativeQuery<T> addScalar(String columnAlias, Class<O> domainJavaType, Class<R> jdbcJavaType, Class<? extends AttributeConverter<O, R>> converter) Deprecated.Use ResultSetMapping, or similar approach pending the outcome of this Jakarta Persistence request.Declare a scalar query result with an explicit conversion.- Parameters:
domainJavaType- The Java type expected by the converter as its "object model" type.jdbcJavaType- The Java type expected by the converter as its "relational model" type.converter- The conversion to apply. Consumes the JDBC value based onrelationalJavaType.- Returns:
this, for method chaining- Since:
- 6.0
-
addInstantiation
@Deprecated(since="8.0") <J> NativeQuery.InstantiationResultNode<J> addInstantiation(Class<J> targetJavaType) Deprecated.Use ResultSetMapping, or similar approach pending the outcome of this Jakarta Persistence request. -
addAttributeResult
@Deprecated(since="8.0") NativeQuery<T> addAttributeResult(String columnAlias, Class entityJavaType, String attributePath) Deprecated.Use ResultSetMapping, or similar approach pending the outcome of this Jakarta Persistence request.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
@Deprecated(since="8.0") NativeQuery<T> addAttributeResult(String columnAlias, String entityName, String attributePath) Deprecated.Use ResultSetMapping, or similar approach pending the outcome of this Jakarta Persistence request.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
@Deprecated(since="8.0") NativeQuery<T> addAttributeResult(String columnAlias, SingularAttribute attribute) Deprecated.Use ResultSetMapping, or similar approach pending the outcome of this Jakarta Persistence request.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
Deprecated.Use ResultSetMapping, or similar approach pending the outcome of this Jakarta Persistence request.Add a new root return mapping, returning aNativeQuery.RootReturnto 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
Deprecated.Use ResultSetMapping, or similar approach pending the outcome of this Jakarta Persistence request.Add a new root return mapping, returning aNativeQuery.RootReturnto 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
Deprecated.Use ResultSetMapping, or similar approach pending the outcome of this Jakarta Persistence request.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(String, 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
Deprecated.Use ResultSetMapping, or similar approach pending the outcome of this Jakarta Persistence request.Declare a "root" entity.- Parameters:
tableAlias- The SQL table aliasentityName- The entity name- Returns:
this, for method chaining
-
addEntity
@Deprecated(since="8.0") NativeQuery<T> addEntity(String tableAlias, String entityName, LockMode lockMode) Deprecated.Use ResultSetMapping, or similar approach pending the outcome of this Jakarta Persistence request.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
Deprecated.Use ResultSetMapping, or similar approach pending the outcome of this Jakarta Persistence request.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
Deprecated.Use ResultSetMapping, or similar approach pending the outcome of this Jakarta Persistence request.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
@Deprecated(since="8.0") NativeQuery<T> addEntity(String tableAlias, Class entityClass, LockMode lockMode) Deprecated.Use ResultSetMapping, or similar approach pending the outcome of this Jakarta Persistence request.Declare a "root" entity, specifying a lock mode.- Parameters:
tableAlias- The SQL table aliasentityClass- The entityClasslockMode- The lock mode for this return- Returns:
this, for method chaining
-
addFetch
@Deprecated(since="8.0") NativeQuery.FetchReturn addFetch(String tableAlias, String ownerTableAlias, String joinPropertyName) Deprecated.Use ResultSetMapping, or similar approach pending the outcome of this Jakarta Persistence request.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
Deprecated.Use ResultSetMapping, or similar approach pending the outcome of this Jakarta Persistence request.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
@Deprecated(since="8.0") NativeQuery<T> addJoin(String tableAlias, String ownerTableAlias, String joinPropertyName) Deprecated.Use ResultSetMapping, or similar approach pending the outcome of this Jakarta Persistence request.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
Deprecated.Use ResultSetMapping, or similar approach pending the outcome of this Jakarta Persistence request.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
-