public class NativeQueryImpl<T> extends AbstractProducedQuery<T> implements NativeQueryImplementor<T>
SQLQuery.FetchReturn, SQLQuery.ReturnProperty, SQLQuery.RootReturn
Constructor and Description |
---|
NativeQueryImpl(NamedSQLQueryDefinition queryDef,
SharedSessionContractImplementor session,
ParameterMetadata parameterMetadata)
Constructs a NativeQueryImpl given a sql query defined in the mappings.
|
NativeQueryImpl(String sqlString,
boolean callable,
SharedSessionContractImplementor session,
ParameterMetadata sqlParameterMetadata) |
Modifier and Type | Method and Description |
---|---|
NativeQueryImplementor<T> |
addEntity(Class entityType)
Declare a "root" entity, without specifying an alias.
|
NativeQueryImplementor<T> |
addEntity(String entityName)
Declare a "root" entity, without specifying an alias.
|
NativeQueryImplementor<T> |
addEntity(String tableAlias,
Class entityClass)
Declare a "root" entity.
|
NativeQueryImplementor<T> |
addEntity(String tableAlias,
Class entityClass,
LockMode lockMode)
Declare a "root" entity, specifying a lock mode.
|
NativeQueryImplementor<T> |
addEntity(String tableAlias,
String entityName)
Declare a "root" entity.
|
NativeQueryImplementor<T> |
addEntity(String tableAlias,
String entityName,
LockMode lockMode)
Declare a "root" entity, specifying a lock mode.
|
SQLQuery.FetchReturn |
addFetch(String tableAlias,
String ownerTableAlias,
String joinPropertyName)
Declare a join fetch result.
|
NativeQueryImplementor<T> |
addJoin(String tableAlias,
String path)
Declare a join fetch result.
|
NativeQueryImplementor<T> |
addJoin(String tableAlias,
String path,
LockMode lockMode)
Declare a join fetch result, specifying a lock mode.
|
NativeQueryImplementor<T> |
addJoin(String tableAlias,
String ownerTableAlias,
String joinPropertyName)
Declare a join fetch result.
|
NativeQueryImplementor<T> |
addQueryHint(String hint)
Add a DB query hint to the SQL.
|
protected void |
addQuerySpaces(Serializable... spaces) |
protected void |
addQuerySpaces(String... spaces) |
protected void |
addReturnBuilder(NativeQueryReturnBuilder builder) |
SQLQuery.RootReturn |
addRoot(String tableAlias,
Class entityType)
Add a new root return mapping, returning a
NativeQuery.RootReturn to allow further definition. |
SQLQuery.RootReturn |
addRoot(String tableAlias,
String entityName)
Add a new root return mapping, returning a
NativeQuery.RootReturn to allow further definition. |
NativeQueryImplementor<T> |
addScalar(String columnAlias)
Declare a scalar query result.
|
NativeQueryImplementor<T> |
addScalar(String columnAlias,
Type type)
Declare a scalar query result.
|
NativeQueryImplementor<T> |
addSynchronizedEntityClass(Class entityClass)
Adds an entity for (a) auto-flush checking and (b) query result cache invalidation checking.
|
NativeQueryImplementor<T> |
addSynchronizedEntityName(String entityName)
Adds an entity name for (a) auto-flush checking and (b) query result cache invalidation checking.
|
NativeQueryImplementor<T> |
addSynchronizedQuerySpace(String querySpace)
Adds a query space.
|
protected void |
applyEntityGraphQueryHint(EntityGraphQueryHint hint)
Used from HEM code as a (hopefully temporary) means to apply a custom query plan
in regards to a JPA entity graph.
|
protected boolean |
applyNativeQueryLockMode(Object value) |
protected void |
beforeQuery() |
protected void |
collectHints(Map<String,Object> hints) |
protected int |
doExecuteUpdate() |
protected List<T> |
doList() |
protected ScrollableResultsImplementor |
doScroll(ScrollMode scrollMode) |
protected QueryParameterBindings |
getQueryParameterBindings() |
QueryParameters |
getQueryParameters() |
List<NativeSQLQueryReturn> |
getQueryReturns()
Retrieve the returns associated with this query.
|
String |
getQueryString()
Get the query string.
|
String[] |
getReturnAliases() |
Type[] |
getReturnTypes()
Return the Hibernate types of the query results.
|
Collection<String> |
getSynchronizedQuerySpaces()
Obtain the list of query spaces the query is synchronized on.
|
boolean |
isCallable()
Is this native-SQL query known to be callable?
|
protected boolean |
isNativeQuery()
Is the query represented here a native (SQL) query?
|
Iterator<T> |
iterate()
Return the query results as an Iterator.
|
NativeQueryImplementor<T> |
setCacheable(boolean cacheable)
Enable/disable second level query (result) caching for this query.
|
NativeQueryImplementor<T> |
setCacheMode(CacheMode cacheMode)
(Re)set the current CacheMode in effect for this query.
|
NativeQueryImplementor<T> |
setCacheRegion(String cacheRegion)
Set the name of the cache region where query results should be cached (if cached at all).
|
NativeQueryImplementor |
setCollectionKey(Serializable key) |
NativeQueryImplementor<T> |
setComment(String comment)
Set the comment for this query.
|
NativeQueryImplementor<T> |
setEntity(int position,
Object val)
Bind an instance of a mapped persistent class to a JDBC-style query parameter.
|
NativeQueryImplementor<T> |
setEntity(String name,
Object val)
Bind an instance of a mapped persistent class to a named query parameter.
|
NativeQueryImplementor<T> |
setFetchSize(int fetchSize)
Sets a JDBC fetch size hint for the query.
|
NativeQueryImplementor<T> |
setFirstResult(int startPosition)
Set the position of the first result to retrieve.
|
NativeQueryImplementor<T> |
setFlushMode(FlushMode flushMode)
(Re)set the current FlushMode in effect for this query.
|
NativeQueryImplementor<T> |
setFlushMode(FlushModeType flushModeType)
Set the flush mode type to be used for the query execution.
|
NativeQueryImplementor<T> |
setHibernateFlushMode(FlushMode flushMode)
(Re)set the current FlushMode in effect for this query.
|
NativeQueryImplementor<T> |
setHint(String hintName,
Object value)
Set a query property or hint.
|
NativeQueryImplementor<T> |
setLockMode(LockModeType lockModeType)
Set the lock mode type to be used for the query execution.
|
NativeQueryImplementor<T> |
setLockMode(String alias,
LockMode lockMode)
Set the LockMode to use for specific alias (as defined in the query's FROM clause).
|
NativeQueryImplementor<T> |
setLockOptions(LockOptions lockOptions)
Set the lock options for the query.
|
NativeQueryImplementor<T> |
setMaxResults(int maxResult)
Set the maximum number of results to retrieve.
|
NativeQueryImplementor<T> |
setParameter(int position,
Calendar value,
TemporalType temporalType)
Bind an instance of
java.util.Calendar to a positional
parameter. |
NativeQueryImplementor<T> |
setParameter(int position,
Date value,
TemporalType temporalType)
Bind an instance of
java.util.Date to a positional parameter. |
NativeQueryImplementor<T> |
setParameter(int position,
Instant value,
TemporalType temporalType) |
NativeQueryImplementor<T> |
setParameter(int position,
LocalDateTime value,
TemporalType temporalType) |
NativeQueryImplementor<T> |
setParameter(int position,
Object value)
Bind an argument value to a positional parameter.
|
NativeQueryImplementor<T> |
setParameter(int position,
Object value,
TemporalType temporalType)
Bind a positional query parameter as some form of date/time using
the indicated temporal-type.
|
NativeQueryImplementor<T> |
setParameter(int position,
Object value,
Type type)
Bind a value to a JDBC-style query parameter.
|
NativeQueryImplementor<T> |
setParameter(int position,
OffsetDateTime value,
TemporalType temporalType) |
NativeQueryImplementor<T> |
setParameter(int position,
ZonedDateTime value,
TemporalType temporalType) |
NativeQueryImplementor<T> |
setParameter(Parameter<Instant> param,
Instant value,
TemporalType temporalType) |
NativeQueryImplementor<T> |
setParameter(Parameter<LocalDateTime> param,
LocalDateTime value,
TemporalType temporalType) |
NativeQueryImplementor<T> |
setParameter(Parameter<OffsetDateTime> param,
OffsetDateTime value,
TemporalType temporalType) |
<P> NativeQueryImplementor<T> |
setParameter(Parameter<P> parameter,
P value)
Bind the value of a
Parameter object. |
NativeQueryImplementor<T> |
setParameter(Parameter<ZonedDateTime> param,
ZonedDateTime value,
TemporalType temporalType) |
NativeQueryImplementor<T> |
setParameter(Parameter param,
Calendar value,
TemporalType temporalType)
Bind an instance of
java.util.Calendar to a Parameter object. |
NativeQueryImplementor<T> |
setParameter(Parameter param,
Date value,
TemporalType temporalType)
Bind an instance of
java.util.Date to a Parameter object. |
<P> NativeQueryImplementor<T> |
setParameter(QueryParameter<P> parameter,
P value,
TemporalType temporalType)
Bind a query parameter as some form of date/time using the indicated
temporal-type.
|
NativeQueryImplementor<T> |
setParameter(QueryParameter parameter,
Object value)
Bind a query parameter using its inferred Type.
|
NativeQueryImplementor<T> |
setParameter(QueryParameter parameter,
Object value,
Type type)
Bind a query parameter using the supplied Type
|
NativeQueryImplementor<T> |
setParameter(String name,
Calendar value,
TemporalType temporalType)
Bind an instance of
java.util.Calendar to a named parameter. |
NativeQueryImplementor<T> |
setParameter(String name,
Date value,
TemporalType temporalType)
Bind an instance of
java.util.Date to a named parameter. |
NativeQueryImplementor<T> |
setParameter(String name,
Instant value,
TemporalType temporalType) |
NativeQueryImplementor<T> |
setParameter(String name,
LocalDateTime value,
TemporalType temporalType) |
NativeQueryImplementor<T> |
setParameter(String name,
Object value)
Bind an argument value to a named parameter.
|
NativeQueryImplementor<T> |
setParameter(String name,
Object value,
TemporalType temporalType)
Bind a named query parameter as some form of date/time using
the indicated temporal-type.
|
NativeQueryImplementor<T> |
setParameter(String name,
Object value,
Type type)
Bind a named query parameter using the supplied Type
|
NativeQueryImplementor<T> |
setParameter(String name,
OffsetDateTime value,
TemporalType temporalType) |
NativeQueryImplementor<T> |
setParameter(String name,
ZonedDateTime value,
TemporalType temporalType) |
NativeQueryImplementor<T> |
setParameterList(QueryParameter parameter,
Collection values)
Bind multiple values to a query parameter using its inferred Type.
|
NativeQueryImplementor<T> |
setParameterList(String name,
Collection values)
Bind multiple values to a named query parameter.
|
NativeQueryImplementor<T> |
setParameterList(String name,
Collection values,
Type type)
Bind multiple values to a named query parameter.
|
NativeQueryImplementor<T> |
setParameterList(String name,
Object[] values)
Bind multiple values to a named query parameter.
|
NativeQueryImplementor<T> |
setParameterList(String name,
Object[] values,
Type type)
Bind multiple values to a named query parameter.
|
NativeQueryImplementor<T> |
setProperties(Map map)
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.
|
NativeQueryImplementor<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.
|
NativeQueryImplementor<T> |
setReadOnly(boolean readOnly)
Set the read-only/modifiable mode for entities and proxies
loaded by this Query.
|
NativeQuery |
setResultSetMapping(String name)
Use a predefined named result-set mapping.
|
NativeQueryImplementor<T> |
setResultTransformer(ResultTransformer transformer)
Set a strategy for handling the query results.
|
NativeQueryImplementor<T> |
setTimeout(int timeout)
Set the query timeout in seconds.
|
afterQuery, applyAliasSpecificLockModeHint, applyCacheableHint, applyCacheModeHint, applyCacheRegionHint, applyCommentHint, applyFetchSizeHint, applyFlushModeHint, applyFollowOnLockingHint, applyHibernateLockModeHint, applyJpaCacheRetrieveMode, applyJpaCacheStoreMode, applyLockModeTypeHint, applyLockTimeoutHint, applyPassDistinctThrough, applyReadOnlyHint, applyTimeoutHint, canApplyAliasSpecificLockModeHints, collectBaselineHints, determineProperBooleanType, determineProperBooleanType, determineType, doIterate, executeUpdate, getCacheMode, getCacheRegion, getComment, getExceptionConverter, getFetchSize, getFirstResult, getFlushMode, getHibernateFlushMode, getHints, getLockMode, getLockOptions, getMaxResults, getNamedParameterMap, getNamedParameters, getParameter, getParameter, getParameter, getParameter, getParameterMetadata, getParameters, getParameterValue, getParameterValue, getParameterValue, getPositionalParameterTypes, getPositionalParameterValues, getProducer, getQueryOptions, getSingleResult, getSupportedHints, getTimeout, handleUnrecognizedHint, isBound, isCacheable, isReadOnly, list, makeQueryParametersForExecution, putIfNotNull, putIfNotNull, resolveEntityName, scroll, scroll, setOptionalEntityName, setOptionalId, setOptionalObject, setParameterList, setParameterList, setParameterList, setParameterList, stream, uniqueElement, uniqueResult, uniqueResultOptional, unwrap
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getProducer, setOptionalEntityName, setOptionalId, setOptionalObject
getCacheMode, getCacheRegion, getComment, getFetchSize, getHibernateFlushMode, getLockOptions, getParameterMetadata, 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, setFloat, setFloat, setInteger, setInteger, setLocale, setLocale, setLong, setLong, setParameters, setSerializable, setSerializable, setShort, setShort, setString, setString, setText, setText, setTime, setTime, setTimestamp, setTimestamp, stream, uniqueResult, uniqueResultOptional
determineProperBooleanType, determineProperBooleanType, getFlushMode, getHibernateFirstResult, getHibernateMaxResults, getNamedParameters, getQueryOptions, getTimeout, isCacheable, isReadOnly, setHibernateFirstResult, setHibernateMaxResults, setParameterList, setParameterList, setParameterList, setParameterList
executeUpdate, getFirstResult, getHints, getLockMode, getMaxResults, getParameter, getParameter, getParameter, getParameter, getParameters, getParameterValue, getParameterValue, getParameterValue, isBound, unwrap
public NativeQueryImpl(NamedSQLQueryDefinition queryDef, SharedSessionContractImplementor session, ParameterMetadata parameterMetadata)
queryDef
- The representation of the defined session
- The session to which this NativeQuery belongs.parameterMetadata
- Metadata about parameters found in the query.public NativeQueryImpl(String sqlString, boolean callable, SharedSessionContractImplementor session, ParameterMetadata sqlParameterMetadata)
protected QueryParameterBindings getQueryParameterBindings()
getQueryParameterBindings
in class AbstractProducedQuery<T>
public NativeQuery setResultSetMapping(String name)
SQLQuery
<result-set/>
element in a
Hibernate hbm.xml file or through a SqlResultSetMapping
annotation.setResultSetMapping
in interface NativeQuery<T>
setResultSetMapping
in interface SQLQuery<T>
name
- The name of the mapping to use.public String getQueryString()
Query
public boolean isCallable()
SQLQuery
isCallable
in interface NativeQuery<T>
isCallable
in interface SQLQuery<T>
isCallable
in class AbstractProducedQuery<T>
true
if the query is known to be callable; false
otherwise.public List<NativeSQLQueryReturn> getQueryReturns()
SQLQuery
getQueryReturns
in interface SQLQuery<T>
protected List<T> doList()
doList
in class AbstractProducedQuery<T>
public QueryParameters getQueryParameters()
getQueryParameters
in class AbstractProducedQuery<T>
protected ScrollableResultsImplementor doScroll(ScrollMode scrollMode)
doScroll
in class AbstractProducedQuery<T>
protected void beforeQuery()
beforeQuery
in class AbstractProducedQuery<T>
public Iterator<T> iterate()
Query
iterate
in class AbstractProducedQuery<T>
protected int doExecuteUpdate()
doExecuteUpdate
in class AbstractProducedQuery<T>
public NativeQueryImplementor setCollectionKey(Serializable key)
setCollectionKey
in interface NativeQueryImplementor<T>
public NativeQueryImplementor<T> addScalar(String columnAlias)
SQLQuery
<return-scalar/>
in hbm.xml
or ColumnResult
addScalar
in interface NativeQuery<T>
addScalar
in interface NativeQueryImplementor<T>
addScalar
in interface SQLQuery<T>
columnAlias
- The column alias in the result-set to be processed as a scalar resultthis
, for method chainingpublic NativeQueryImplementor<T> addScalar(String columnAlias, Type type)
SQLQuery
addScalar
in interface NativeQuery<T>
addScalar
in interface NativeQueryImplementor<T>
addScalar
in interface SQLQuery<T>
columnAlias
- The column alias in the result-set to be processed as a scalar resulttype
- The Hibernate type as which to treat the value.this
, for method chainingprotected void addReturnBuilder(NativeQueryReturnBuilder builder)
public SQLQuery.RootReturn addRoot(String tableAlias, String entityName)
SQLQuery
NativeQuery.RootReturn
to allow further definition.addRoot
in interface NativeQuery<T>
addRoot
in interface NativeQueryImplementor<T>
addRoot
in interface SQLQuery<T>
tableAlias
- The SQL table alias to map to this entityentityName
- The name of the entity.public SQLQuery.RootReturn addRoot(String tableAlias, Class entityType)
SQLQuery
NativeQuery.RootReturn
to allow further definition.public NativeQueryImplementor<T> addEntity(String entityName)
SQLQuery
SQLQuery.addRoot(java.lang.String, java.lang.String)
if you need further control of the mappingaddEntity
in interface NativeQuery<T>
addEntity
in interface NativeQueryImplementor<T>
addEntity
in interface SQLQuery<T>
entityName
- The entity name that is the root return of the query.this
, for method chainingpublic NativeQueryImplementor<T> addEntity(String tableAlias, String entityName)
SQLQuery
addEntity
in interface NativeQuery<T>
addEntity
in interface NativeQueryImplementor<T>
addEntity
in interface SQLQuery<T>
tableAlias
- The SQL table aliasentityName
- The entity namethis
, for method chainingpublic NativeQueryImplementor<T> addEntity(String tableAlias, String entityName, LockMode lockMode)
SQLQuery
addEntity
in interface NativeQuery<T>
addEntity
in interface NativeQueryImplementor<T>
addEntity
in interface SQLQuery<T>
tableAlias
- The SQL table aliasentityName
- The entity namelockMode
- The lock mode for this return.this
, for method chainingpublic NativeQueryImplementor<T> addEntity(Class entityType)
SQLQuery
addEntity
in interface NativeQuery<T>
addEntity
in interface NativeQueryImplementor<T>
addEntity
in interface SQLQuery<T>
entityType
- The java type of the entity to add as a rootthis
, for method chainingpublic NativeQueryImplementor<T> addEntity(String tableAlias, Class entityClass)
SQLQuery
addEntity
in interface NativeQuery<T>
addEntity
in interface NativeQueryImplementor<T>
addEntity
in interface SQLQuery<T>
tableAlias
- The SQL table aliasentityClass
- The java type of the entity to add as a rootthis
, for method chainingpublic NativeQueryImplementor<T> addEntity(String tableAlias, Class entityClass, LockMode lockMode)
SQLQuery
addEntity
in interface NativeQuery<T>
addEntity
in interface NativeQueryImplementor<T>
addEntity
in interface SQLQuery<T>
tableAlias
- The SQL table aliasentityClass
- The entity ClasslockMode
- The lock mode for this return.this
, for method chainingpublic SQLQuery.FetchReturn addFetch(String tableAlias, String ownerTableAlias, String joinPropertyName)
SQLQuery
addFetch
in interface NativeQuery<T>
addFetch
in interface SQLQuery<T>
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.public NativeQueryImplementor<T> addJoin(String tableAlias, String path)
SQLQuery
addJoin
in interface NativeQuery<T>
addJoin
in interface NativeQueryImplementor<T>
addJoin
in interface SQLQuery<T>
tableAlias
- The SQL table alias for the data to be mapped to this fetchpath
- The association path ([owner-alias].[property-name]).this
, for method chainingpublic NativeQueryImplementor<T> addJoin(String tableAlias, String ownerTableAlias, String joinPropertyName)
SQLQuery
addJoin
in interface NativeQuery<T>
addJoin
in interface NativeQueryImplementor<T>
addJoin
in interface SQLQuery<T>
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.this
, for method chainingpublic NativeQueryImplementor<T> addJoin(String tableAlias, String path, LockMode lockMode)
SQLQuery
addJoin
in interface NativeQuery<T>
addJoin
in interface NativeQueryImplementor<T>
addJoin
in interface SQLQuery<T>
tableAlias
- The SQL table alias for the data to be mapped to this fetchpath
- The association path ([owner-alias].[property-name]).lockMode
- The lock mode for this return.this
, for method chainingpublic String[] getReturnAliases()
public Type[] getReturnTypes()
Query
getReturnTypes
in interface BasicQueryContract<CommonQueryContract>
public NativeQueryImplementor<T> setEntity(int position, Object val)
Query
Query.setParameter(int, Object)
for null values.position
- the position of the parameter in the query
string, numbered from 0.val
- a non-null instance of a persistent classthis
, for method chainingpublic NativeQueryImplementor<T> setEntity(String name, Object val)
Query
Query.setParameter(String, Object)
for null values.name
- the name of the parameterval
- a non-null instance of a persistent classthis
, for method chainingpublic Collection<String> getSynchronizedQuerySpaces()
SynchronizeableQuery
getSynchronizedQuerySpaces
in interface SynchronizeableQuery<T>
public NativeQueryImplementor<T> addSynchronizedQuerySpace(String querySpace)
SynchronizeableQuery
addSynchronizedQuerySpace
in interface NativeQuery<T>
addSynchronizedQuerySpace
in interface NativeQueryImplementor<T>
addSynchronizedQuerySpace
in interface SQLQuery<T>
addSynchronizedQuerySpace
in interface SynchronizeableQuery<T>
querySpace
- The query space to be auto-flushed for this query.this
, for method chainingprotected void addQuerySpaces(String... spaces)
protected void addQuerySpaces(Serializable... spaces)
public NativeQueryImplementor<T> addSynchronizedEntityName(String entityName) throws MappingException
SynchronizeableQuery
SynchronizeableQuery.addSynchronizedQuerySpace(java.lang.String)
for all tables associated with the given entity.addSynchronizedEntityName
in interface NativeQuery<T>
addSynchronizedEntityName
in interface NativeQueryImplementor<T>
addSynchronizedEntityName
in interface SQLQuery<T>
addSynchronizedEntityName
in interface SynchronizeableQuery<T>
entityName
- The name of the entity upon whose defined query spaces we should additionally synchronize.this
, for method chainingMappingException
- Indicates the given name could not be resolved as an entitypublic NativeQueryImplementor<T> addSynchronizedEntityClass(Class entityClass) throws MappingException
SynchronizeableQuery
SynchronizeableQuery.addSynchronizedQuerySpace(java.lang.String)
for all tables associated with the given entity.addSynchronizedEntityClass
in interface NativeQuery<T>
addSynchronizedEntityClass
in interface NativeQueryImplementor<T>
addSynchronizedEntityClass
in interface SQLQuery<T>
addSynchronizedEntityClass
in interface SynchronizeableQuery<T>
entityClass
- The class of the entity upon whose defined query spaces we should additionally synchronize.this
, for method chainingMappingException
- Indicates the given class could not be resolved as an entityprotected boolean isNativeQuery()
AbstractProducedQuery
isNativeQuery
in class AbstractProducedQuery<T>
true
if it is a native query; false
otherwisepublic NativeQueryImplementor<T> setHibernateFlushMode(FlushMode flushMode)
Query
setHibernateFlushMode
in interface BasicQueryContract<CommonQueryContract>
setHibernateFlushMode
in interface NativeQuery<T>
setHibernateFlushMode
in interface NativeQueryImplementor<T>
setHibernateFlushMode
in interface SQLQuery<T>
setHibernateFlushMode
in class AbstractProducedQuery<T>
flushMode
- The new FlushMode to use.this
, for method chainingQuery.getHibernateFlushMode()
public NativeQueryImplementor<T> setFlushMode(FlushMode flushMode)
Query
setFlushMode
in interface BasicQueryContract<CommonQueryContract>
setFlushMode
in interface NativeQuery<T>
setFlushMode
in interface NativeQueryImplementor<T>
setFlushMode
in interface SQLQuery<T>
setFlushMode
in class AbstractProducedQuery<T>
flushMode
- The new FlushMode to use.this
, for method chainingQuery.getHibernateFlushMode()
public NativeQueryImplementor<T> setFlushMode(FlushModeType flushModeType)
TypedQuery
setFlushMode
in interface Query
setFlushMode
in interface TypedQuery<T>
setFlushMode
in interface NativeQuery<T>
setFlushMode
in interface SQLQuery<T>
setFlushMode
in class AbstractProducedQuery<T>
flushModeType
- flush modepublic NativeQueryImplementor<T> setCacheMode(CacheMode cacheMode)
Query
setCacheMode
in interface BasicQueryContract<CommonQueryContract>
setCacheMode
in interface NativeQuery<T>
setCacheMode
in interface NativeQueryImplementor<T>
setCacheMode
in interface SQLQuery<T>
setCacheMode
in class AbstractProducedQuery<T>
cacheMode
- The new CacheMode to use.this
, for method chainingQuery.getCacheMode()
public NativeQueryImplementor<T> setCacheable(boolean cacheable)
Query
setCacheable
in interface BasicQueryContract<CommonQueryContract>
setCacheable
in interface NativeQuery<T>
setCacheable
in interface NativeQueryImplementor<T>
setCacheable
in interface SQLQuery<T>
setCacheable
in class AbstractProducedQuery<T>
cacheable
- Should the query results be cacheable?this
, for method chainingQuery.isCacheable()
public NativeQueryImplementor<T> setCacheRegion(String cacheRegion)
Query
setCacheRegion
in interface BasicQueryContract<CommonQueryContract>
setCacheRegion
in interface NativeQuery<T>
setCacheRegion
in interface NativeQueryImplementor<T>
setCacheRegion
in interface SQLQuery<T>
setCacheRegion
in class AbstractProducedQuery<T>
cacheRegion
- the name of a query cache region, or null
to indicate that the default region
should be used.this
, for method chainingQuery.getCacheRegion()
public NativeQueryImplementor<T> setTimeout(int timeout)
Query
setTimeout
in interface BasicQueryContract<CommonQueryContract>
setTimeout
in interface NativeQuery<T>
setTimeout
in interface NativeQueryImplementor<T>
setTimeout
in interface SQLQuery<T>
setTimeout
in class AbstractProducedQuery<T>
timeout
- the timeout in secondsthis
, for method chainingQuery.getTimeout()
public NativeQueryImplementor<T> setFetchSize(int fetchSize)
Query
setFetchSize
in interface BasicQueryContract<CommonQueryContract>
setFetchSize
in interface NativeQuery<T>
setFetchSize
in interface NativeQueryImplementor<T>
setFetchSize
in interface SQLQuery<T>
setFetchSize
in class AbstractProducedQuery<T>
fetchSize
- the fetch size hintthis
, for method chainingQuery.getFetchSize()
public NativeQueryImplementor<T> setReadOnly(boolean readOnly)
Query
setReadOnly
in interface BasicQueryContract<CommonQueryContract>
setReadOnly
in interface NativeQuery<T>
setReadOnly
in interface NativeQueryImplementor<T>
setReadOnly
in interface SQLQuery<T>
setReadOnly
in class AbstractProducedQuery<T>
readOnly
- true
indicates that entities and proxies loaded by the query
are to be put in read-only mode; false
indicates that entities and proxies
loaded by the query will be put in modifiable modethis
, for method chainingTo 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.
public NativeQueryImplementor<T> setLockOptions(LockOptions lockOptions)
Query
Query.setLockMode(String, LockMode)
.setLockOptions
in interface NativeQuery<T>
setLockOptions
in interface NativeQueryImplementor<T>
setLockOptions
in interface SQLQuery<T>
setLockOptions
in class AbstractProducedQuery<T>
lockOptions
- The lock options to apply to the query.this
, for method chainingQuery.getLockOptions()
public NativeQueryImplementor<T> setLockMode(String alias, LockMode lockMode)
Query
LockOptions
.
The effect of these alias-specific LockModes is somewhat dependent on the driver/database in use. Generally
speaking, for maximum portability, this method should only be used to mark that the rows corresponding to
the given alias should be included in pessimistic locking (LockMode.PESSIMISTIC_WRITE
).setLockMode
in interface NativeQuery<T>
setLockMode
in interface NativeQueryImplementor<T>
setLockMode
in interface SQLQuery<T>
setLockMode
in class AbstractProducedQuery<T>
alias
- a query alias, or "this"
for a collection filterlockMode
- The lock mode to apply.this
, for method chainingQuery.getLockOptions()
public NativeQueryImplementor<T> setLockMode(LockModeType lockModeType)
TypedQuery
setLockMode
in interface Query
setLockMode
in interface TypedQuery<T>
setLockMode
in interface NativeQuery<T>
setLockMode
in class AbstractProducedQuery<T>
lockModeType
- lock modepublic NativeQueryImplementor<T> setComment(String comment)
Query
setComment
in interface NativeQuery<T>
setComment
in interface NativeQueryImplementor<T>
setComment
in interface SQLQuery<T>
setComment
in class AbstractProducedQuery<T>
comment
- The human-readable commentthis
, for method chainingQuery.getComment()
public NativeQueryImplementor<T> addQueryHint(String hint)
Query
QueryHint
, 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.addQueryHint
in interface NativeQuery<T>
addQueryHint
in interface NativeQueryImplementor<T>
addQueryHint
in interface SQLQuery<T>
addQueryHint
in class AbstractProducedQuery<T>
hint
- The database specific query hint to add.protected void collectHints(Map<String,Object> hints)
collectHints
in class AbstractProducedQuery<T>
protected boolean applyNativeQueryLockMode(Object value)
applyNativeQueryLockMode
in class AbstractProducedQuery<T>
public NativeQueryImplementor<T> setParameter(QueryParameter parameter, Object value)
Query
Query.setParameter(QueryParameter, Object, Type)
should be used insteadsetParameter
in interface NativeQuery<T>
setParameter
in interface NativeQueryImplementor<T>
setParameter
in interface SQLQuery<T>
setParameter
in class AbstractProducedQuery<T>
parameter
- The query parameter mementovalue
- the possibly-null parameter valuethis
, for method chainingpublic <P> NativeQueryImplementor<T> setParameter(Parameter<P> parameter, P value)
TypedQuery
Parameter
object.setParameter
in interface Query
setParameter
in interface TypedQuery<T>
setParameter
in interface NativeQuery<T>
setParameter
in interface NativeQueryImplementor<T>
setParameter
in interface SQLQuery<T>
setParameter
in class AbstractProducedQuery<T>
parameter
- parameter objectvalue
- parameter valuepublic NativeQueryImplementor<T> setParameter(String name, Object value)
TypedQuery
setParameter
in interface Query
setParameter
in interface TypedQuery<T>
setParameter
in interface NativeQuery<T>
setParameter
in interface NativeQueryImplementor<T>
setParameter
in interface SQLQuery<T>
setParameter
in class AbstractProducedQuery<T>
name
- parameter namevalue
- parameter valuepublic NativeQueryImplementor<T> setParameter(int position, Object value)
TypedQuery
setParameter
in interface Query
setParameter
in interface TypedQuery<T>
setParameter
in interface NativeQuery<T>
setParameter
in interface NativeQueryImplementor<T>
setParameter
in interface SQLQuery<T>
setParameter
in class AbstractProducedQuery<T>
position
- positionvalue
- parameter valuepublic NativeQueryImplementor<T> setParameter(QueryParameter parameter, Object value, Type type)
Query
setParameter
in interface NativeQuery<T>
setParameter
in interface NativeQueryImplementor<T>
setParameter
in interface SQLQuery<T>
setParameter
in class AbstractProducedQuery<T>
parameter
- The query parameter mementovalue
- the possibly-null parameter valuetype
- the Hibernate typethis
, for method chainingpublic NativeQueryImplementor<T> setParameter(String name, Object value, Type type)
Query
setParameter
in interface NativeQuery<T>
setParameter
in interface NativeQueryImplementor<T>
setParameter
in interface SQLQuery<T>
setParameter
in class AbstractProducedQuery<T>
name
- the name of the parametervalue
- the possibly-null parameter valuetype
- the Hibernate typethis
, for method chainingpublic NativeQueryImplementor<T> setParameter(int position, Object value, Type type)
Query
setParameter
in interface NativeQuery<T>
setParameter
in interface NativeQueryImplementor<T>
setParameter
in interface SQLQuery<T>
setParameter
in class AbstractProducedQuery<T>
position
- the position of the parameter in the query
string, numbered from 0.value
- the possibly-null parameter valuetype
- the Hibernate typethis
, for method chainingpublic <P> NativeQueryImplementor<T> setParameter(QueryParameter<P> parameter, P value, TemporalType temporalType)
Query
setParameter
in interface NativeQuery<T>
setParameter
in interface NativeQueryImplementor<T>
setParameter
in interface SQLQuery<T>
setParameter
in class AbstractProducedQuery<T>
parameter
- The query parameter mementovalue
- the possibly-null parameter valuetemporalType
- the temporal-type to use in binding the date/timethis
, for method chainingpublic NativeQueryImplementor<T> setParameter(String name, Object value, TemporalType temporalType)
Query
setParameter
in interface NativeQuery<T>
setParameter
in interface NativeQueryImplementor<T>
setParameter
in interface SQLQuery<T>
setParameter
in class AbstractProducedQuery<T>
name
- the parameter namevalue
- the possibly-null parameter valuetemporalType
- the temporal-type to use in binding the date/timethis
, for method chainingpublic NativeQueryImplementor<T> setParameter(int position, Object value, TemporalType temporalType)
Query
setParameter
in interface NativeQuery<T>
setParameter
in interface NativeQueryImplementor<T>
setParameter
in interface SQLQuery<T>
setParameter
in class AbstractProducedQuery<T>
position
- the position of the parameter in the query
string, numbered from 0.value
- the possibly-null parameter valuetemporalType
- the temporal-type to use in binding the date/timethis
, for method chainingpublic NativeQueryImplementor<T> setParameter(Parameter<Instant> param, Instant value, TemporalType temporalType)
setParameter
in interface NativeQuery<T>
setParameter
in class AbstractProducedQuery<T>
public NativeQueryImplementor<T> setParameter(Parameter<LocalDateTime> param, LocalDateTime value, TemporalType temporalType)
setParameter
in interface NativeQuery<T>
setParameter
in class AbstractProducedQuery<T>
public NativeQueryImplementor<T> setParameter(Parameter<ZonedDateTime> param, ZonedDateTime value, TemporalType temporalType)
setParameter
in interface NativeQuery<T>
setParameter
in class AbstractProducedQuery<T>
public NativeQueryImplementor<T> setParameter(Parameter<OffsetDateTime> param, OffsetDateTime value, TemporalType temporalType)
setParameter
in interface NativeQuery<T>
setParameter
in class AbstractProducedQuery<T>
public NativeQueryImplementor<T> setParameter(String name, Instant value, TemporalType temporalType)
setParameter
in interface NativeQuery<T>
setParameter
in class AbstractProducedQuery<T>
public NativeQueryImplementor<T> setParameter(String name, LocalDateTime value, TemporalType temporalType)
setParameter
in interface NativeQuery<T>
setParameter
in class AbstractProducedQuery<T>
public NativeQueryImplementor<T> setParameter(String name, ZonedDateTime value, TemporalType temporalType)
setParameter
in interface NativeQuery<T>
setParameter
in class AbstractProducedQuery<T>
public NativeQueryImplementor<T> setParameter(String name, OffsetDateTime value, TemporalType temporalType)
setParameter
in interface NativeQuery<T>
setParameter
in class AbstractProducedQuery<T>
public NativeQueryImplementor<T> setParameter(int position, Instant value, TemporalType temporalType)
setParameter
in interface NativeQuery<T>
setParameter
in class AbstractProducedQuery<T>
public NativeQueryImplementor<T> setParameter(int position, LocalDateTime value, TemporalType temporalType)
setParameter
in interface NativeQuery<T>
setParameter
in class AbstractProducedQuery<T>
public NativeQueryImplementor<T> setParameter(int position, ZonedDateTime value, TemporalType temporalType)
setParameter
in interface NativeQuery<T>
setParameter
in class AbstractProducedQuery<T>
public NativeQueryImplementor<T> setParameter(int position, OffsetDateTime value, TemporalType temporalType)
setParameter
in interface NativeQuery<T>
setParameter
in class AbstractProducedQuery<T>
public NativeQueryImplementor<T> setParameterList(QueryParameter parameter, Collection values)
Query
setParameterList
in interface NativeQuery<T>
setParameterList
in interface NativeQueryImplementor<T>
setParameterList
in interface SQLQuery<T>
setParameterList
in class AbstractProducedQuery<T>
parameter
- the parameter mementovalues
- a collection of values to listthis
, for method chainingpublic NativeQueryImplementor<T> setParameterList(String name, Collection values)
Query
setParameterList
in interface NativeQuery<T>
setParameterList
in interface NativeQueryImplementor<T>
setParameterList
in interface SQLQuery<T>
setParameterList
in class AbstractProducedQuery<T>
name
- the name of the parametervalues
- a collection of values to listthis
, for method chainingpublic NativeQueryImplementor<T> setParameterList(String name, Collection values, Type type)
Query
setParameterList
in interface NativeQuery<T>
setParameterList
in interface NativeQueryImplementor<T>
setParameterList
in interface SQLQuery<T>
setParameterList
in class AbstractProducedQuery<T>
name
- the name of the parametervalues
- a collection of values to listtype
- the Hibernate type of the valuesthis
, for method chainingpublic NativeQueryImplementor<T> setParameterList(String name, Object[] values, Type type)
Query
setParameterList
in interface NativeQuery<T>
setParameterList
in interface NativeQueryImplementor<T>
setParameterList
in interface SQLQuery<T>
setParameterList
in class AbstractProducedQuery<T>
name
- the name of the parametervalues
- a collection of values to listtype
- the Hibernate type of the valuesthis
, for method chainingpublic NativeQueryImplementor<T> setParameterList(String name, Object[] values)
Query
setParameterList
in interface NativeQuery<T>
setParameterList
in interface NativeQueryImplementor<T>
setParameterList
in interface SQLQuery<T>
setParameterList
in class AbstractProducedQuery<T>
name
- the name of the parametervalues
- a collection of values to listthis
, for method chainingpublic NativeQueryImplementor<T> setParameter(Parameter param, Calendar value, TemporalType temporalType)
TypedQuery
java.util.Calendar
to a Parameter
object.setParameter
in interface Query
setParameter
in interface TypedQuery<T>
setParameter
in interface NativeQuery<T>
setParameter
in interface NativeQueryImplementor<T>
setParameter
in interface SQLQuery<T>
setParameter
in class AbstractProducedQuery<T>
param
- parameter objectvalue
- parameter valuetemporalType
- temporal typepublic NativeQueryImplementor<T> setParameter(Parameter param, Date value, TemporalType temporalType)
TypedQuery
java.util.Date
to a Parameter
object.setParameter
in interface Query
setParameter
in interface TypedQuery<T>
setParameter
in interface NativeQuery<T>
setParameter
in interface NativeQueryImplementor<T>
setParameter
in interface SQLQuery<T>
setParameter
in class AbstractProducedQuery<T>
param
- parameter objectvalue
- parameter valuetemporalType
- temporal typepublic NativeQueryImplementor<T> setParameter(String name, Calendar value, TemporalType temporalType)
TypedQuery
java.util.Calendar
to a named parameter.setParameter
in interface Query
setParameter
in interface TypedQuery<T>
setParameter
in interface NativeQuery<T>
setParameter
in interface NativeQueryImplementor<T>
setParameter
in interface SQLQuery<T>
setParameter
in class AbstractProducedQuery<T>
name
- parameter namevalue
- parameter valuetemporalType
- temporal typepublic NativeQueryImplementor<T> setParameter(String name, Date value, TemporalType temporalType)
TypedQuery
java.util.Date
to a named parameter.setParameter
in interface Query
setParameter
in interface TypedQuery<T>
setParameter
in interface NativeQuery<T>
setParameter
in interface NativeQueryImplementor<T>
setParameter
in interface SQLQuery<T>
setParameter
in class AbstractProducedQuery<T>
name
- parameter namevalue
- parameter valuetemporalType
- temporal typepublic NativeQueryImplementor<T> setParameter(int position, Calendar value, TemporalType temporalType)
TypedQuery
java.util.Calendar
to a positional
parameter.setParameter
in interface Query
setParameter
in interface TypedQuery<T>
setParameter
in interface NativeQuery<T>
setParameter
in interface NativeQueryImplementor<T>
setParameter
in interface SQLQuery<T>
setParameter
in class AbstractProducedQuery<T>
position
- positionvalue
- parameter valuetemporalType
- temporal typepublic NativeQueryImplementor<T> setParameter(int position, Date value, TemporalType temporalType)
TypedQuery
java.util.Date
to a positional parameter.setParameter
in interface Query
setParameter
in interface TypedQuery<T>
setParameter
in interface NativeQuery<T>
setParameter
in interface NativeQueryImplementor<T>
setParameter
in interface SQLQuery<T>
setParameter
in class AbstractProducedQuery<T>
position
- positionvalue
- parameter valuetemporalType
- temporal typepublic NativeQueryImplementor<T> setResultTransformer(ResultTransformer transformer)
Query
setResultTransformer
in class AbstractProducedQuery<T>
transformer
- The transformer to applypublic NativeQueryImplementor<T> setProperties(Map map)
Query
setProperties
in interface NativeQuery<T>
setProperties
in interface NativeQueryImplementor<T>
setProperties
in interface SQLQuery<T>
setProperties
in class AbstractProducedQuery<T>
map
- a java.util.Mapthis
, for method chainingpublic NativeQueryImplementor<T> setProperties(Object bean)
Query
setProperties
in interface NativeQuery<T>
setProperties
in interface NativeQueryImplementor<T>
setProperties
in interface SQLQuery<T>
setProperties
in class AbstractProducedQuery<T>
bean
- any JavaBean or POJOthis
, for method chainingpublic NativeQueryImplementor<T> setMaxResults(int maxResult)
TypedQuery
setMaxResults
in interface Query
setMaxResults
in interface TypedQuery<T>
setMaxResults
in interface NativeQuery<T>
setMaxResults
in class AbstractProducedQuery<T>
maxResult
- maximum number of results to retrievepublic NativeQueryImplementor<T> setFirstResult(int startPosition)
TypedQuery
setFirstResult
in interface Query
setFirstResult
in interface TypedQuery<T>
setFirstResult
in interface NativeQuery<T>
setFirstResult
in class AbstractProducedQuery<T>
startPosition
- position of the first result,
numbered from 0public NativeQueryImplementor<T> setHint(String hintName, Object value)
TypedQuery
setHint
in interface Query
setHint
in interface TypedQuery<T>
setHint
in interface NativeQuery<T>
setHint
in class AbstractProducedQuery<T>
hintName
- name of property or hintvalue
- value for the property or hintprotected void applyEntityGraphQueryHint(EntityGraphQueryHint hint)
AbstractProducedQuery
applyEntityGraphQueryHint
in class AbstractProducedQuery<T>
hint
- The entity graph hint objectCopyright © 2019 JBoss by Red Hat. All rights reserved.