Package org.hibernate.query
Interface NativeQuery<T>
-
- All Superinterfaces:
BasicQueryContract<CommonQueryContract>,CommonQueryContract,Query,Query<T>,Query<T>,SQLQuery<T>,SynchronizeableQuery<T>,TypedQuery<T>
- All Known Subinterfaces:
NativeQueryImplementor<T>
public interface NativeQuery<T> extends Query<T>, SQLQuery<T>, SynchronizeableQuery<T>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.hibernate.SQLQuery
SQLQuery.FetchReturn, SQLQuery.ReturnProperty, SQLQuery.RootReturn
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description 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.SQLQuery.FetchReturnaddFetch(String tableAlias, String ownerTableAlias, String joinPropertyName)Declare a join fetch result.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 DB query hint to the SQL.SQLQuery.RootReturnaddRoot(String tableAlias, Class entityType)Add a new root return mapping, returning aSQLQuery.RootReturnto allow further definition.SQLQuery.RootReturnaddRoot(String tableAlias, String entityName)Add a new root return mapping, returning aSQLQuery.RootReturnto allow further definition.NativeQuery<T>addScalar(String columnAlias)Declare a scalar query result.NativeQuery<T>addScalar(String columnAlias, Type type)Declare a scalar query result.NativeQuery<T>addSynchronizedEntityClass(Class entityClass)Adds an entity for (a) auto-flush checking and (b) query result cache invalidation checking.NativeQuery<T>addSynchronizedEntityName(String entityName)Adds an entity name for (a) auto-flush checking and (b) query result cache invalidation checking.NativeQuery<T>addSynchronizedQuerySpace(String querySpace)Adds a query space.booleanisCallable()Is this native-SQL query known to be callable?NativeQuery<T>setCacheable(boolean cacheable)Enable/disable second level query (result) caching for this query.NativeQuery<T>setCacheMode(CacheMode cacheMode)(Re)set the current CacheMode in effect for this query.NativeQuery<T>setCacheRegion(String cacheRegion)Set the name of the cache region where query results should be cached (if cached at all).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)NativeQuery<T>setFlushMode(FlushModeType flushMode)NativeQuery<T>setFlushMode(FlushMode flushMode)(Re)set the current FlushMode in effect for this query.NativeQuery<T>setHibernateFlushMode(FlushMode flushMode)(Re)set the current FlushMode in effect for this query.NativeQuery<T>setHint(String hintName, Object value)NativeQuery<T>setLockMode(String alias, LockMode lockMode)Set the LockMode to use for specific alias (as defined in the query's FROM clause).NativeQuery<T>setLockMode(LockModeType lockMode)NativeQuery<T>setLockOptions(LockOptions lockOptions)Set the lock options for the query.NativeQuery<T>setMaxResults(int maxResult)NativeQuery<T>setParameter(int position, Object value)Bind a positional query parameter using its inferred Type.NativeQuery<T>setParameter(int position, Object val, TemporalType temporalType)Bind a positional query parameter as some form of date/time using the indicated temporal-type.NativeQuery<T>setParameter(int position, Object val, Type type)Bind a value to a JDBC-style query parameter.NativeQuery<T>setParameter(int position, Instant value, TemporalType temporalType)NativeQuery<T>setParameter(int position, LocalDateTime value, TemporalType temporalType)NativeQuery<T>setParameter(int position, OffsetDateTime value, TemporalType temporalType)NativeQuery<T>setParameter(int position, ZonedDateTime value, TemporalType temporalType)NativeQuery<T>setParameter(int position, Calendar value, TemporalType temporalType)NativeQuery<T>setParameter(int position, Date value, TemporalType temporalType)NativeQuery<T>setParameter(String name, Object value)Bind a named query parameter using its inferred Type.NativeQuery<T>setParameter(String name, Object val, TemporalType temporalType)Bind a named query parameter as some form of date/time using the indicated temporal-type.NativeQuery<T>setParameter(String name, Object val, Type type)Bind a named query parameter using the supplied TypeNativeQuery<T>setParameter(String name, Instant value, TemporalType temporalType)NativeQuery<T>setParameter(String name, LocalDateTime value, TemporalType temporalType)NativeQuery<T>setParameter(String name, OffsetDateTime value, TemporalType temporalType)NativeQuery<T>setParameter(String name, ZonedDateTime value, TemporalType temporalType)NativeQuery<T>setParameter(String name, Calendar value, TemporalType temporalType)NativeQuery<T>setParameter(String name, Date value, TemporalType temporalType)NativeQuery<T>setParameter(Parameter<Instant> param, Instant value, TemporalType temporalType)NativeQuery<T>setParameter(Parameter<LocalDateTime> param, LocalDateTime value, TemporalType temporalType)NativeQuery<T>setParameter(Parameter<OffsetDateTime> param, OffsetDateTime value, TemporalType temporalType)NativeQuery<T>setParameter(Parameter<ZonedDateTime> param, ZonedDateTime value, TemporalType temporalType)NativeQuery<T>setParameter(Parameter<Calendar> param, Calendar value, TemporalType temporalType)NativeQuery<T>setParameter(Parameter<Date> param, Date value, TemporalType temporalType)<P> NativeQuery<T>setParameter(Parameter<P> param, P value)<P> NativeQuery<T>setParameter(QueryParameter<P> parameter, P val)Bind a query parameter using its inferred Type.<P> NativeQuery<T>setParameter(QueryParameter<P> parameter, P val, TemporalType temporalType)Bind a query parameter as some form of date/time using the indicated temporal-type.<P> NativeQuery<T>setParameter(QueryParameter<P> parameter, P val, Type type)Bind a query parameter using the supplied TypeNativeQuery<T>setParameterList(String name, Object[] values)Bind multiple values to a named query parameter.NativeQuery<T>setParameterList(String name, Object[] values, Type type)Bind multiple values to a named query parameter.NativeQuery<T>setParameterList(String name, Collection values)Bind multiple values to a named query parameter.NativeQuery<T>setParameterList(String name, Collection values, Type type)Bind multiple values to a named query parameter.<P> NativeQuery<T>setParameterList(QueryParameter<P> parameter, Collection<P> values)Bind multiple values to a query parameter using its inferred Type.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 given Map 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 this Query.NativeQuery<T>setResultSetMapping(String name)Use a predefined named result-set mapping.NativeQuery<T>setTimeout(int timeout)Set the query timeout in seconds.-
Methods inherited from interface javax.persistence.Query
executeUpdate, getFirstResult, getHints, getLockMode, getMaxResults, getParameter, getParameter, getParameter, getParameter, getParameters, getParameterValue, getParameterValue, getParameterValue, isBound, unwrap
-
Methods inherited from interface org.hibernate.Query
determineProperBooleanType, determineProperBooleanType, getFlushMode, getHibernateFirstResult, getHibernateMaxResults, getNamedParameters, getQueryOptions, getReturnAliases, getReturnTypes, getTimeout, isCacheable, isReadOnly, iterate, setHibernateFirstResult, setHibernateMaxResults, setParameterList, setParameterList, setParameterList, setParameterList
-
Methods inherited from interface org.hibernate.query.Query
applyFetchGraph, applyGraph, applyLoadGraph, getCacheMode, getCacheRegion, getComment, getFetchSize, getHibernateFlushMode, getLockOptions, getParameterMetadata, getProducer, getQueryString, getResultList, getResultStream, getSingleResult, list, scroll, scroll, setBigDecimal, setBigDecimal, setBigInteger, setBigInteger, setBinary, setBinary, setBoolean, setBoolean, setByte, setByte, setCalendar, setCalendar, setCalendarDate, setCalendarDate, setCharacter, setCharacter, setDate, setDate, setDouble, setDouble, setEntity, setEntity, setFloat, setFloat, setInteger, setInteger, setLocale, setLocale, setLong, setLong, setParameters, setResultTransformer, setSerializable, setSerializable, setShort, setShort, setString, setString, setText, setText, setTime, setTime, setTimestamp, setTimestamp, stream, uniqueResult, uniqueResultOptional
-
Methods inherited from interface org.hibernate.SQLQuery
getQueryReturns
-
Methods inherited from interface org.hibernate.SynchronizeableQuery
addSynchronizedEntityClass, addSynchronizedEntityName, addSynchronizedQuerySpace, addSynchronizedTable, addSynchronizedTable, getSynchronizedQuerySpaces
-
-
-
-
Method Detail
-
setFlushMode
NativeQuery<T> setFlushMode(FlushMode flushMode)
Description copied from interface:Query(Re)set the current FlushMode in effect for this query.- Specified by:
setFlushModein interfaceBasicQueryContract<T>- Specified by:
setFlushModein interfaceQuery<T>- Specified by:
setFlushModein interfaceQuery<T>- Specified by:
setFlushModein interfaceSQLQuery<T>- Parameters:
flushMode- The new FlushMode to use.- Returns:
this, for method chaining- See Also:
Query.getHibernateFlushMode()
-
setResultSetMapping
NativeQuery<T> setResultSetMapping(String name)
Description copied from interface:SQLQueryUse a predefined named result-set mapping. This might be defined by a<result-set/>element in a Hibernate hbm.xml file or through aSqlResultSetMappingannotation.- Specified by:
setResultSetMappingin interfaceSQLQuery<T>- Parameters:
name- The name of the mapping to use.- Returns:
- this, for method chaining
-
setParameter
<P> NativeQuery<T> setParameter(QueryParameter<P> parameter, P val)
Description copied from interface:QueryBind a query parameter using its inferred Type. If the parameter is defined in such a way that the Type cannot be inferred from its usage context then use of this form of binding is not allowed, andQuery.setParameter(QueryParameter, Object, Type)should be used instead- Specified by:
setParameterin interfaceQuery<T>- Specified by:
setParameterin interfaceQuery<T>- Specified by:
setParameterin interfaceSQLQuery<T>- Parameters:
parameter- The query parameter mementoval- the possibly-null parameter value- Returns:
this, for method chaining
-
setParameter
<P> NativeQuery<T> setParameter(Parameter<P> param, P value)
- Specified by:
setParameterin interfaceQuery- Specified by:
setParameterin interfaceQuery<T>- Specified by:
setParameterin interfaceQuery<T>- Specified by:
setParameterin interfaceSQLQuery<T>- Specified by:
setParameterin interfaceTypedQuery<T>
-
setParameter
<P> NativeQuery<T> setParameter(QueryParameter<P> parameter, P val, Type type)
Description copied from interface:QueryBind a query parameter using the supplied Type- Specified by:
setParameterin interfaceQuery<T>- Specified by:
setParameterin interfaceQuery<T>- Specified by:
setParameterin interfaceSQLQuery<T>- Parameters:
parameter- The query parameter mementoval- the possibly-null parameter valuetype- the Hibernate type- Returns:
this, for method chaining
-
setParameter
NativeQuery<T> setParameter(String name, Object val, Type type)
Description copied from interface:QueryBind a named query parameter using the supplied Type- Specified by:
setParameterin interfaceQuery<T>- Specified by:
setParameterin interfaceQuery<T>- Specified by:
setParameterin interfaceSQLQuery<T>- Parameters:
name- the name of the parameterval- the possibly-null parameter valuetype- the Hibernate type- Returns:
this, for method chaining
-
setParameter
NativeQuery<T> setParameter(int position, Object val, Type type)
Description copied from interface:QueryBind a value to a JDBC-style query parameter.- Specified by:
setParameterin interfaceQuery<T>- Specified by:
setParameterin interfaceQuery<T>- Specified by:
setParameterin interfaceSQLQuery<T>- Parameters:
position- the position of the parameter in the query string, numbered from 0.val- the possibly-null parameter valuetype- the Hibernate type- Returns:
this, for method chaining
-
setParameter
<P> NativeQuery<T> setParameter(QueryParameter<P> parameter, P val, TemporalType temporalType)
Description copied from interface:QueryBind a query parameter as some form of date/time using the indicated temporal-type.- Specified by:
setParameterin interfaceQuery<T>- Specified by:
setParameterin interfaceQuery<T>- Specified by:
setParameterin interfaceSQLQuery<T>- Parameters:
parameter- The query parameter mementoval- the possibly-null parameter valuetemporalType- the temporal-type to use in binding the date/time- Returns:
this, for method chaining
-
setParameter
NativeQuery<T> setParameter(String name, Object val, TemporalType temporalType)
Description copied from interface:QueryBind a named query parameter as some form of date/time using the indicated temporal-type.- Specified by:
setParameterin interfaceQuery<T>- Specified by:
setParameterin interfaceQuery<T>- Specified by:
setParameterin interfaceSQLQuery<T>- Parameters:
name- the parameter nameval- the possibly-null parameter valuetemporalType- the temporal-type to use in binding the date/time- Returns:
this, for method chaining
-
setParameter
NativeQuery<T> setParameter(int position, Object val, TemporalType temporalType)
Description copied from interface:QueryBind a positional query parameter as some form of date/time using the indicated temporal-type.- Specified by:
setParameterin interfaceQuery<T>- Specified by:
setParameterin interfaceQuery<T>- Specified by:
setParameterin interfaceSQLQuery<T>- Parameters:
position- the position of the parameter in the query string, numbered from 0.val- the possibly-null parameter valuetemporalType- the temporal-type to use in binding the date/time- Returns:
this, for method chaining
-
setParameter
NativeQuery<T> setParameter(Parameter<Calendar> param, Calendar value, TemporalType temporalType)
- Specified by:
setParameterin interfaceQuery- Specified by:
setParameterin interfaceQuery<T>- Specified by:
setParameterin interfaceQuery<T>- Specified by:
setParameterin interfaceSQLQuery<T>- Specified by:
setParameterin interfaceTypedQuery<T>
-
setParameter
NativeQuery<T> setParameter(Parameter<Date> param, Date value, TemporalType temporalType)
- Specified by:
setParameterin interfaceQuery- Specified by:
setParameterin interfaceQuery<T>- Specified by:
setParameterin interfaceQuery<T>- Specified by:
setParameterin interfaceSQLQuery<T>- Specified by:
setParameterin interfaceTypedQuery<T>
-
setParameter
NativeQuery<T> setParameter(String name, Object value)
Description copied from interface:QueryBind a named query parameter using its inferred Type. If the parameter is defined in such a way that the Type cannot be inferred from its usage context then use of this form of binding is not allowed, andQuery.setParameter(String, Object, Type)should be used instead- Specified by:
setParameterin interfaceQuery- Specified by:
setParameterin interfaceQuery<T>- Specified by:
setParameterin interfaceQuery<T>- Specified by:
setParameterin interfaceSQLQuery<T>- Specified by:
setParameterin interfaceTypedQuery<T>- Parameters:
name- the parameter namevalue- the (possibly-null) parameter value- Returns:
this, for method chaining
-
setParameter
NativeQuery<T> setParameter(String name, Calendar value, TemporalType temporalType)
- Specified by:
setParameterin interfaceQuery- Specified by:
setParameterin interfaceQuery<T>- Specified by:
setParameterin interfaceQuery<T>- Specified by:
setParameterin interfaceSQLQuery<T>- Specified by:
setParameterin interfaceTypedQuery<T>
-
setParameter
NativeQuery<T> setParameter(String name, Date value, TemporalType temporalType)
- Specified by:
setParameterin interfaceQuery- Specified by:
setParameterin interfaceQuery<T>- Specified by:
setParameterin interfaceQuery<T>- Specified by:
setParameterin interfaceSQLQuery<T>- Specified by:
setParameterin interfaceTypedQuery<T>
-
setParameter
NativeQuery<T> setParameter(int position, Object value)
Description copied from interface:QueryBind a positional query parameter using its inferred Type. If the parameter is defined in such a way that the Type cannot be inferred from its usage context then use of this form of binding is not allowed, andQuery.setParameter(int, Object, Type)should be used instead- Specified by:
setParameterin interfaceQuery- Specified by:
setParameterin interfaceQuery<T>- Specified by:
setParameterin interfaceQuery<T>- Specified by:
setParameterin interfaceSQLQuery<T>- Specified by:
setParameterin interfaceTypedQuery<T>- Parameters:
position- the position of the parameter in the query string, numbered from 0.value- the possibly-null parameter value- Returns:
this, for method chaining
-
setParameter
NativeQuery<T> setParameter(int position, Calendar value, TemporalType temporalType)
- Specified by:
setParameterin interfaceQuery- Specified by:
setParameterin interfaceQuery<T>- Specified by:
setParameterin interfaceQuery<T>- Specified by:
setParameterin interfaceSQLQuery<T>- Specified by:
setParameterin interfaceTypedQuery<T>
-
setParameter
NativeQuery<T> setParameter(int position, Date value, TemporalType temporalType)
- Specified by:
setParameterin interfaceQuery- Specified by:
setParameterin interfaceQuery<T>- Specified by:
setParameterin interfaceQuery<T>- Specified by:
setParameterin interfaceSQLQuery<T>- Specified by:
setParameterin interfaceTypedQuery<T>
-
setParameter
NativeQuery<T> setParameter(Parameter<Instant> param, Instant value, TemporalType temporalType)
- Specified by:
setParameterin interfaceQuery<T>
-
setParameter
NativeQuery<T> setParameter(Parameter<LocalDateTime> param, LocalDateTime value, TemporalType temporalType)
- Specified by:
setParameterin interfaceQuery<T>
-
setParameter
NativeQuery<T> setParameter(Parameter<ZonedDateTime> param, ZonedDateTime value, TemporalType temporalType)
- Specified by:
setParameterin interfaceQuery<T>
-
setParameter
NativeQuery<T> setParameter(Parameter<OffsetDateTime> param, OffsetDateTime value, TemporalType temporalType)
- Specified by:
setParameterin interfaceQuery<T>
-
setParameter
NativeQuery<T> setParameter(String name, Instant value, TemporalType temporalType)
- Specified by:
setParameterin interfaceQuery<T>
-
setParameter
NativeQuery<T> setParameter(String name, LocalDateTime value, TemporalType temporalType)
- Specified by:
setParameterin interfaceQuery<T>
-
setParameter
NativeQuery<T> setParameter(String name, ZonedDateTime value, TemporalType temporalType)
- Specified by:
setParameterin interfaceQuery<T>
-
setParameter
NativeQuery<T> setParameter(String name, OffsetDateTime value, TemporalType temporalType)
- Specified by:
setParameterin interfaceQuery<T>
-
setParameter
NativeQuery<T> setParameter(int position, Instant value, TemporalType temporalType)
- Specified by:
setParameterin interfaceQuery<T>
-
setParameter
NativeQuery<T> setParameter(int position, LocalDateTime value, TemporalType temporalType)
- Specified by:
setParameterin interfaceQuery<T>
-
setParameter
NativeQuery<T> setParameter(int position, ZonedDateTime value, TemporalType temporalType)
- Specified by:
setParameterin interfaceQuery<T>
-
setParameter
NativeQuery<T> setParameter(int position, OffsetDateTime value, TemporalType temporalType)
- Specified by:
setParameterin interfaceQuery<T>
-
setParameterList
<P> NativeQuery<T> setParameterList(QueryParameter<P> parameter, Collection<P> values)
Description copied from interface:QueryBind multiple values to a query parameter using its inferred Type. The Hibernate type of the parameter values is first detected via the usage/position in the query and if not sufficient secondly guessed from the class of the first object in the collection. This is useful for binding a list of values to an expression such as foo.bar in (:value_list).- Specified by:
setParameterListin interfaceQuery<T>- Specified by:
setParameterListin interfaceQuery<T>- Specified by:
setParameterListin interfaceSQLQuery<T>- Parameters:
parameter- the parameter mementovalues- a collection of values to list- Returns:
this, for method chaining
-
setParameterList
NativeQuery<T> setParameterList(String name, Collection values)
Description copied from interface:QueryBind multiple values to a named query parameter. The Hibernate type of the parameter is first detected via the usage/position in the query and if not sufficient secondly guessed from the class of the first object in the collection. This is useful for binding a list of values to an expression such as foo.bar in (:value_list).- Specified by:
setParameterListin interfaceQuery<T>- Specified by:
setParameterListin interfaceQuery<T>- Specified by:
setParameterListin interfaceSQLQuery<T>- Parameters:
name- the name of the parametervalues- a collection of values to list- Returns:
this, for method chaining
-
setParameterList
NativeQuery<T> setParameterList(String name, Collection values, Type type)
Description copied from interface:QueryBind multiple values to a named query parameter. This is useful for binding a list of values to an expression such as foo.bar in (:value_list).- Specified by:
setParameterListin interfaceQuery<T>- Specified by:
setParameterListin interfaceQuery<T>- Specified by:
setParameterListin interfaceSQLQuery<T>- Parameters:
name- the name of the parametervalues- a collection of values to listtype- the Hibernate type of the values- Returns:
this, for method chaining
-
setParameterList
NativeQuery<T> setParameterList(String name, Object[] values, Type type)
Description copied from interface:QueryBind multiple values to a named query parameter. This is useful for binding a list of values to an expression such as foo.bar in (:value_list).- Specified by:
setParameterListin interfaceQuery<T>- Specified by:
setParameterListin interfaceQuery<T>- Specified by:
setParameterListin interfaceSQLQuery<T>- Parameters:
name- the name of the parametervalues- a collection of values to listtype- the Hibernate type of the values- Returns:
this, for method chaining
-
setParameterList
NativeQuery<T> setParameterList(String name, Object[] values)
Description copied from interface:QueryBind multiple values to a named query parameter. The Hibernate type of the parameter is first detected via the usage/position in the query and if not sufficient secondly guessed from the class of the first object in the array. This is useful for binding a list of values to an expression such as foo.bar in (:value_list).- Specified by:
setParameterListin interfaceQuery<T>- Specified by:
setParameterListin interfaceQuery<T>- Specified by:
setParameterListin interfaceSQLQuery<T>- Parameters:
name- the name of the parametervalues- a collection of values to list- Returns:
this, for method chaining
-
setProperties
NativeQuery<T> setProperties(Object bean)
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 interfaceQuery<T>- Specified by:
setPropertiesin interfaceQuery<T>- Specified by:
setPropertiesin interfaceSQLQuery<T>- Parameters:
bean- any JavaBean or POJO- Returns:
this, for method chaining
-
setProperties
NativeQuery<T> setProperties(Map bean)
Description copied from interface:QueryBind the values of the given Map for each named parameters of the query, matching key names with parameter names and mapping value types to Hibernate types using heuristics.- Specified by:
setPropertiesin interfaceQuery<T>- Specified by:
setPropertiesin interfaceQuery<T>- Specified by:
setPropertiesin interfaceSQLQuery<T>- Parameters:
bean- a java.util.Map- Returns:
this, for method chaining
-
addSynchronizedQuerySpace
NativeQuery<T> addSynchronizedQuerySpace(String querySpace)
Description copied from interface:SynchronizeableQueryAdds a query space.- Specified by:
addSynchronizedQuerySpacein interfaceSQLQuery<T>- Specified by:
addSynchronizedQuerySpacein interfaceSynchronizeableQuery<T>- Parameters:
querySpace- The query space to be auto-flushed for this query.- Returns:
this, for method chaining
-
addSynchronizedEntityName
NativeQuery<T> addSynchronizedEntityName(String entityName) throws MappingException
Description copied from interface:SynchronizeableQueryAdds an entity name for (a) auto-flush checking and (b) query result cache invalidation checking. Same asSynchronizeableQuery.addSynchronizedQuerySpace(java.lang.String)for all tables associated with the given entity.- Specified by:
addSynchronizedEntityNamein interfaceSQLQuery<T>- Specified by:
addSynchronizedEntityNamein interfaceSynchronizeableQuery<T>- Parameters:
entityName- The name of the entity upon whose defined query spaces we should additionally synchronize.- 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:SynchronizeableQueryAdds an entity for (a) auto-flush checking and (b) query result cache invalidation checking. Same asSynchronizeableQuery.addSynchronizedQuerySpace(java.lang.String)for all tables associated with the given entity.- Specified by:
addSynchronizedEntityClassin interfaceSQLQuery<T>- Specified by:
addSynchronizedEntityClassin interfaceSynchronizeableQuery<T>- Parameters:
entityClass- The class of the entity upon whose defined query spaces we should additionally synchronize.- Returns:
this, for method chaining- Throws:
MappingException- Indicates the given class could not be resolved as an entity
-
isCallable
boolean isCallable()
Description copied from interface:SQLQueryIs this native-SQL query known to be callable?- Specified by:
isCallablein interfaceSQLQuery<T>- Returns:
trueif the query is known to be callable;falseotherwise.
-
addScalar
NativeQuery<T> addScalar(String columnAlias)
Description copied from interface:SQLQueryDeclare a scalar query result. Hibernate will attempt to automatically detect the underlying type. Functions like<return-scalar/>inhbm.xmlorColumnResult
-
addScalar
NativeQuery<T> addScalar(String columnAlias, Type type)
Description copied from interface:SQLQuery
-
addRoot
SQLQuery.RootReturn addRoot(String tableAlias, String entityName)
Description copied from interface:SQLQueryAdd a new root return mapping, returning aSQLQuery.RootReturnto allow further definition.
-
addRoot
SQLQuery.RootReturn addRoot(String tableAlias, Class entityType)
Description copied from interface:SQLQueryAdd a new root return mapping, returning aSQLQuery.RootReturnto allow further definition.
-
addEntity
NativeQuery<T> addEntity(String entityName)
Description copied from interface:SQLQueryDeclare a "root" entity, without specifying an alias. The expectation here is that the table alias is the same as the unqualified entity name UseSQLQuery.addRoot(java.lang.String, java.lang.String)if you need further control of the mapping
-
addEntity
NativeQuery<T> addEntity(String tableAlias, String entityName)
Description copied from interface:SQLQueryDeclare a "root" entity.
-
addEntity
NativeQuery<T> addEntity(String tableAlias, String entityName, LockMode lockMode)
Description copied from interface:SQLQueryDeclare a "root" entity, specifying a lock mode.
-
addEntity
NativeQuery<T> addEntity(Class entityType)
Description copied from interface:SQLQueryDeclare a "root" entity, without specifying an alias. The expectation here is that the table alias is the same as the unqualified entity name
-
addEntity
NativeQuery<T> addEntity(String tableAlias, Class entityType)
Description copied from interface:SQLQueryDeclare a "root" entity.
-
addEntity
NativeQuery<T> addEntity(String tableAlias, Class entityClass, LockMode lockMode)
Description copied from interface:SQLQueryDeclare a "root" entity, specifying a lock mode.
-
addFetch
SQLQuery.FetchReturn addFetch(String tableAlias, String ownerTableAlias, String joinPropertyName)
Description copied from interface:SQLQueryDeclare a join fetch result.- Specified by:
addFetchin interfaceSQLQuery<T>- 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 fetchjoinPropertyName- The name of the property being join fetched.- Returns:
- The return config object for further control.
-
addJoin
NativeQuery<T> addJoin(String tableAlias, String path)
Description copied from interface:SQLQueryDeclare a join fetch result.
-
addJoin
NativeQuery<T> addJoin(String tableAlias, String ownerTableAlias, String joinPropertyName)
Description copied from interface:SQLQueryDeclare a join fetch result.- Specified by:
addJoinin interfaceSQLQuery<T>- 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 fetchjoinPropertyName- The name of the property being join fetched.- Returns:
this, for method chaining
-
addJoin
NativeQuery<T> addJoin(String tableAlias, String path, LockMode lockMode)
Description copied from interface:SQLQueryDeclare a join fetch result, specifying a lock mode.
-
setHibernateFlushMode
NativeQuery<T> setHibernateFlushMode(FlushMode flushMode)
Description copied from interface:Query(Re)set the current FlushMode in effect for this query.- Specified by:
setHibernateFlushModein interfaceBasicQueryContract<T>- Specified by:
setHibernateFlushModein interfaceQuery<T>- Specified by:
setHibernateFlushModein interfaceQuery<T>- Specified by:
setHibernateFlushModein interfaceSQLQuery<T>- Parameters:
flushMode- The new FlushMode to use.- Returns:
this, for method chaining- See Also:
Query.getHibernateFlushMode()
-
setFlushMode
NativeQuery<T> setFlushMode(FlushModeType flushMode)
- Specified by:
setFlushModein interfaceQuery- Specified by:
setFlushModein interfaceQuery<T>- Specified by:
setFlushModein interfaceQuery<T>- Specified by:
setFlushModein interfaceSQLQuery<T>- Specified by:
setFlushModein interfaceTypedQuery<T>
-
setCacheMode
NativeQuery<T> setCacheMode(CacheMode cacheMode)
Description copied from interface:Query(Re)set the current CacheMode in effect for this query.- Specified by:
setCacheModein interfaceBasicQueryContract<T>- Specified by:
setCacheModein interfaceQuery<T>- Specified by:
setCacheModein interfaceQuery<T>- Specified by:
setCacheModein interfaceSQLQuery<T>- Parameters:
cacheMode- The new CacheMode to use.- Returns:
this, for method chaining- See Also:
Query.getCacheMode()
-
setCacheable
NativeQuery<T> setCacheable(boolean cacheable)
Description copied from interface:QueryEnable/disable second level query (result) caching for this query.- Specified by:
setCacheablein interfaceBasicQueryContract<T>- Specified by:
setCacheablein interfaceQuery<T>- Specified by:
setCacheablein interfaceQuery<T>- Specified by:
setCacheablein interfaceSQLQuery<T>- Parameters:
cacheable- Should the query results be cacheable?- Returns:
this, for method chaining- See Also:
Query.isCacheable()
-
setCacheRegion
NativeQuery<T> setCacheRegion(String cacheRegion)
Description copied from interface:QuerySet the name of the cache region where query results should be cached (if cached at all).- Specified by:
setCacheRegionin interfaceBasicQueryContract<T>- Specified by:
setCacheRegionin interfaceQuery<T>- Specified by:
setCacheRegionin interfaceQuery<T>- Specified by:
setCacheRegionin interfaceSQLQuery<T>- Parameters:
cacheRegion- the name of a query cache region, ornullto indicate that the default region should be used.- Returns:
this, for method chaining- See Also:
Query.getCacheRegion()
-
setTimeout
NativeQuery<T> setTimeout(int timeout)
Description copied from interface:QuerySet the query timeout in seconds. NOTE it is important to understand that any value set here is eventually passed directly through to the JDBC Statement which expressly disallows negative values. So negative values should be avoided as a general rule.- Specified by:
setTimeoutin interfaceBasicQueryContract<T>- Specified by:
setTimeoutin interfaceQuery<T>- Specified by:
setTimeoutin interfaceQuery<T>- Specified by:
setTimeoutin interfaceSQLQuery<T>- Parameters:
timeout- the timeout in seconds- Returns:
this, for method chaining- See Also:
Query.getTimeout()
-
setFetchSize
NativeQuery<T> setFetchSize(int fetchSize)
Description copied from interface:QuerySets a JDBC fetch size hint for the query.- Specified by:
setFetchSizein interfaceBasicQueryContract<T>- Specified by:
setFetchSizein interfaceQuery<T>- Specified by:
setFetchSizein interfaceQuery<T>- Specified by:
setFetchSizein interfaceSQLQuery<T>- Parameters:
fetchSize- the fetch size hint- Returns:
this, for method chaining- See Also:
Query.getFetchSize()
-
setReadOnly
NativeQuery<T> setReadOnly(boolean readOnly)
Description copied from interface:QuerySet the read-only/modifiable mode for entities and proxies loaded by this Query. This setting overrides the default setting for the persistence context.- Specified by:
setReadOnlyin interfaceBasicQueryContract<T>- Specified by:
setReadOnlyin interfaceQuery<T>- Specified by:
setReadOnlyin interfaceQuery<T>- Specified by:
setReadOnlyin interfaceSQLQuery<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- See Also:
To set the default read-only/modifiable setting used for entities and proxies that are loaded into the session:,PersistenceContext.setDefaultReadOnly(boolean),Read-only entities are not dirty-checked and snapshots of persistent state are not maintained. Read-only entities can be modified, but changes are not persisted. When a proxy is initialized, the loaded entity will have the same read-only/modifiable setting as the uninitialized proxy has, regardless of the session's current setting. The read-only/modifiable setting has no impact on entities/proxies returned by the query that existed in the session before the query was executed.
-
setLockOptions
NativeQuery<T> setLockOptions(LockOptions lockOptions)
Description copied from interface:QuerySet the lock options for the query. Specifically only the following are taken into consideration: For alias-specific locking, useQuery.setLockMode(String, LockMode).- Specified by:
setLockOptionsin interfaceQuery<T>- Specified by:
setLockOptionsin interfaceQuery<T>- Specified by:
setLockOptionsin interfaceSQLQuery<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)
Description copied from interface:QuerySet the LockMode to use for specific alias (as defined in the query's FROM clause). The alias-specific lock modes specified here are added to the query's internalLockOptions. The effect of these alias-specific LockModes is somewhat dependent on the driver/database in use. Generally speaking, for maximum portability, this method should only be used to mark that the rows corresponding to the given alias should be included in pessimistic locking (LockMode.PESSIMISTIC_WRITE).- Specified by:
setLockModein interfaceQuery<T>- Specified by:
setLockModein interfaceQuery<T>- Specified by:
setLockModein interfaceSQLQuery<T>- Parameters:
alias- a query alias, or"this"for a collection filterlockMode- The lock mode to apply.- Returns:
this, for method chaining- See Also:
Query.getLockOptions()
-
setComment
NativeQuery<T> setComment(String comment)
Description copied from interface:QuerySet the comment for this query.- Specified by:
setCommentin interfaceQuery<T>- Specified by:
setCommentin interfaceQuery<T>- Specified by:
setCommentin interfaceSQLQuery<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:QueryAdd a DB query hint to the SQL. These differ from JPA'sQueryHint, which is specific to the JPA implementation and ignores DB vendor-specific hints. Instead, these are intended solely for the vendor-specific hints, such as Oracle's optimizers. Multiple query hints are supported; the Dialect will determine concatenation and placement.- Specified by:
addQueryHintin interfaceQuery<T>- Specified by:
addQueryHintin interfaceQuery<T>- Specified by:
addQueryHintin interfaceSQLQuery<T>- Parameters:
hint- The database specific query hint to add.
-
setMaxResults
NativeQuery<T> setMaxResults(int maxResult)
- Specified by:
setMaxResultsin interfaceQuery- Specified by:
setMaxResultsin interfaceQuery<T>- Specified by:
setMaxResultsin interfaceQuery<T>- Specified by:
setMaxResultsin interfaceTypedQuery<T>
-
setFirstResult
NativeQuery<T> setFirstResult(int startPosition)
- Specified by:
setFirstResultin interfaceQuery- Specified by:
setFirstResultin interfaceQuery<T>- Specified by:
setFirstResultin interfaceQuery<T>- Specified by:
setFirstResultin interfaceTypedQuery<T>
-
setHint
NativeQuery<T> setHint(String hintName, Object value)
-
setLockMode
NativeQuery<T> setLockMode(LockModeType lockMode)
- Specified by:
setLockModein interfaceQuery- Specified by:
setLockModein interfaceQuery<T>- Specified by:
setLockModein interfaceQuery<T>- Specified by:
setLockModein interfaceTypedQuery<T>
-
-