public abstract class AbstractProducedQuery<R> extends java.lang.Object implements QueryImplementor<R>
Constructor and Description |
---|
AbstractProducedQuery(SharedSessionContractImplementor producer,
ParameterMetadata parameterMetadata) |
Modifier and Type | Method and Description |
---|---|
QueryImplementor |
addQueryHint(java.lang.String hint)
Add a DB query hint to the SQL.
|
protected void |
afterQuery() |
protected void |
applyAliasSpecificLockModeHint(java.lang.String alias,
LockMode lockMode)
Apply the alias specific lock modes.
|
protected boolean |
applyCacheableHint(boolean isCacheable)
Apply the cacheable (true/false) hint.
|
protected boolean |
applyCacheModeHint(CacheMode cacheMode)
Apply the CacheMode hint.
|
protected boolean |
applyCacheRegionHint(java.lang.String regionName)
Apply the cache region hint
|
protected boolean |
applyCommentHint(java.lang.String comment)
Apply the comment hint.
|
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 |
applyFetchSizeHint(int fetchSize)
Apply the fetch size hint
|
protected boolean |
applyFlushModeHint(FlushMode flushMode)
Apply the FlushMode hint.
|
protected boolean |
applyFollowOnLockingHint(java.lang.Boolean followOnLocking)
Apply the follow-on-locking hint.
|
protected boolean |
applyHibernateLockModeHint(LockMode lockMode) |
protected boolean |
applyJpaCacheRetrieveMode(javax.persistence.CacheRetrieveMode mode) |
protected boolean |
applyJpaCacheStoreMode(javax.persistence.CacheStoreMode storeMode) |
protected boolean |
applyLockModeTypeHint(javax.persistence.LockModeType lockModeType) |
protected boolean |
applyLockTimeoutHint(int timeout)
Apply the lock timeout (in seconds!) hint
|
protected boolean |
applyNativeQueryLockMode(java.lang.Object value) |
protected boolean |
applyPassDistinctThrough(boolean passDistinctThrough)
Apply the follow-on-locking hint.
|
protected boolean |
applyReadOnlyHint(boolean isReadOnly)
Apply the read-only (true/false) hint.
|
protected boolean |
applyTimeoutHint(int timeout)
Apply the query timeout hint.
|
protected void |
beforeQuery() |
protected boolean |
canApplyAliasSpecificLockModeHints()
Can alias-specific lock modes be applied?
|
protected void |
collectBaselineHints(java.util.Map<java.lang.String,java.lang.Object> hints) |
protected void |
collectHints(java.util.Map<java.lang.String,java.lang.Object> hints) |
Type |
determineProperBooleanType(int position,
java.lang.Object value,
Type defaultType) |
Type |
determineProperBooleanType(java.lang.String name,
java.lang.Object value,
Type defaultType) |
protected Type |
determineType(java.lang.String namedParam,
java.lang.Class retType) |
protected int |
doExecuteUpdate() |
protected java.util.Iterator<R> |
doIterate() |
protected java.util.List<R> |
doList() |
protected ScrollableResultsImplementor |
doScroll(ScrollMode scrollMode) |
int |
executeUpdate() |
CacheMode |
getCacheMode()
Obtain the CacheMode in effect for this query.
|
java.lang.String |
getCacheRegion()
Obtain the name of the second level query cache region in which query results will be stored (if they are
cached, see the discussion on
Query.isCacheable() for more information). |
java.lang.String |
getComment()
Obtain the comment currently associated with this query.
|
protected ExceptionConverter |
getExceptionConverter() |
java.lang.Integer |
getFetchSize()
Obtain the JDBC fetch size hint in effect for this query.
|
int |
getFirstResult() |
javax.persistence.FlushModeType |
getFlushMode()
For users of the Hibernate native APIs, we've had to rename this method
as defined by Hibernate historically because the JPA contract defines a method of the same
name, but returning the JPA
FlushModeType rather than Hibernate's FlushMode . |
FlushMode |
getHibernateFlushMode()
Obtain the FlushMode in effect for this query.
|
java.util.Map<java.lang.String,java.lang.Object> |
getHints() |
javax.persistence.LockModeType |
getLockMode() |
LockOptions |
getLockOptions()
Obtains the LockOptions in effect for this query.
|
int |
getMaxResults() |
protected java.util.Map<java.lang.String,TypedValue> |
getNamedParameterMap() |
java.lang.String[] |
getNamedParameters()
Return the names of all named parameters of the query.
|
javax.persistence.Parameter<?> |
getParameter(int position) |
<T> javax.persistence.Parameter<T> |
getParameter(int position,
java.lang.Class<T> type) |
javax.persistence.Parameter<?> |
getParameter(java.lang.String name) |
<T> javax.persistence.Parameter<T> |
getParameter(java.lang.String name,
java.lang.Class<T> type) |
ParameterMetadata |
getParameterMetadata()
Access to information about query parameters.
|
java.util.Set<javax.persistence.Parameter<?>> |
getParameters() |
java.lang.Object |
getParameterValue(int position) |
<T> T |
getParameterValue(javax.persistence.Parameter<T> parameter) |
java.lang.Object |
getParameterValue(java.lang.String name) |
protected Type[] |
getPositionalParameterTypes() |
protected java.lang.Object[] |
getPositionalParameterValues() |
SharedSessionContractImplementor |
getProducer()
Get the QueryProducer this Query originates from.
|
RowSelection |
getQueryOptions()
"QueryOptions" is a better name, I think, than "RowSelection" -> 6.0
|
QueryParameterBindingsImpl |
getQueryParameterBindings() |
QueryParameters |
getQueryParameters() |
R |
getSingleResult() |
java.util.Set<java.lang.String> |
getSupportedHints() |
java.lang.Integer |
getTimeout()
Obtain the query timeout in seconds.
|
boolean |
isBound(javax.persistence.Parameter<?> parameter) |
boolean |
isCacheable()
Are the results of this query eligible for second level query caching? This is different that second level
caching of any returned entities and collections.
|
protected boolean |
isCallable() |
protected abstract boolean |
isNativeQuery()
Is the query represented here a native (SQL) query?
|
boolean |
isReadOnly()
Should entities and proxies loaded by this Query be put in read-only mode? If the
read-only/modifiable setting was not initialized, then the default
read-only/modifiable setting for the persistence context is returned instead.
|
java.util.Iterator<R> |
iterate()
Return the query results as an Iterator.
|
java.util.List<R> |
list()
Return the query results as a List.
|
protected void |
putIfNotNull(java.util.Map<java.lang.String,java.lang.Object> hints,
java.lang.String hintName,
java.lang.Enum hintValue) |
protected void |
putIfNotNull(java.util.Map<java.lang.String,java.lang.Object> hints,
java.lang.String hintName,
java.lang.Object hintValue) |
protected java.lang.String |
resolveEntityName(java.lang.Object val) |
ScrollableResultsImplementor |
scroll()
Return the query results as ScrollableResults.
|
ScrollableResultsImplementor |
scroll(ScrollMode scrollMode)
Return the query results as ScrollableResults.
|
QueryImplementor |
setCacheable(boolean cacheable)
Enable/disable second level query (result) caching for this query.
|
QueryImplementor |
setCacheMode(CacheMode cacheMode)
(Re)set the current CacheMode in effect for this query.
|
QueryImplementor |
setCacheRegion(java.lang.String cacheRegion)
Set the name of the cache region where query results should be cached (if cached at all).
|
QueryImplementor |
setComment(java.lang.String comment)
Set the comment for this query.
|
QueryImplementor |
setFetchSize(int fetchSize)
Sets a JDBC fetch size hint for the query.
|
QueryImplementor |
setFirstResult(int startPosition) |
QueryImplementor |
setFlushMode(FlushMode flushMode)
(Re)set the current FlushMode in effect for this query.
|
QueryImplementor |
setFlushMode(javax.persistence.FlushModeType flushModeType) |
QueryImplementor |
setHibernateFlushMode(FlushMode flushMode)
(Re)set the current FlushMode in effect for this query.
|
QueryImplementor |
setHint(java.lang.String hintName,
java.lang.Object value) |
QueryImplementor |
setLockMode(javax.persistence.LockModeType lockModeType) |
QueryImplementor |
setLockMode(java.lang.String alias,
LockMode lockMode)
Set the LockMode to use for specific alias (as defined in the query's FROM clause).
|
QueryImplementor |
setLockOptions(LockOptions lockOptions)
Set the lock options for the query.
|
QueryImplementor |
setMaxResults(int maxResult) |
void |
setOptionalEntityName(java.lang.String optionalEntityName) |
void |
setOptionalId(java.io.Serializable optionalId) |
void |
setOptionalObject(java.lang.Object optionalObject) |
QueryImplementor |
setParameter(int position,
java.util.Calendar value,
javax.persistence.TemporalType temporalType) |
QueryImplementor |
setParameter(int position,
java.util.Date value,
javax.persistence.TemporalType temporalType) |
QueryImplementor<R> |
setParameter(int position,
java.time.Instant value,
javax.persistence.TemporalType temporalType) |
QueryImplementor<R> |
setParameter(int position,
java.time.LocalDateTime value,
javax.persistence.TemporalType temporalType) |
QueryImplementor |
setParameter(int position,
java.lang.Object value)
Bind a positional query parameter using its inferred Type.
|
QueryImplementor |
setParameter(int position,
java.lang.Object value,
javax.persistence.TemporalType temporalType)
Bind a positional query parameter as some form of date/time using
the indicated temporal-type.
|
QueryImplementor |
setParameter(int position,
java.lang.Object value,
Type type)
Bind a value to a JDBC-style query parameter.
|
QueryImplementor<R> |
setParameter(int position,
java.time.OffsetDateTime value,
javax.persistence.TemporalType temporalType) |
QueryImplementor<R> |
setParameter(int position,
java.time.ZonedDateTime value,
javax.persistence.TemporalType temporalType) |
QueryImplementor |
setParameter(javax.persistence.Parameter<java.util.Calendar> param,
java.util.Calendar value,
javax.persistence.TemporalType temporalType) |
QueryImplementor |
setParameter(javax.persistence.Parameter<java.util.Date> param,
java.util.Date value,
javax.persistence.TemporalType temporalType) |
QueryImplementor<R> |
setParameter(javax.persistence.Parameter<java.time.Instant> param,
java.time.Instant value,
javax.persistence.TemporalType temporalType) |
QueryImplementor<R> |
setParameter(javax.persistence.Parameter<java.time.LocalDateTime> param,
java.time.LocalDateTime value,
javax.persistence.TemporalType temporalType) |
QueryImplementor<R> |
setParameter(javax.persistence.Parameter<java.time.OffsetDateTime> param,
java.time.OffsetDateTime value,
javax.persistence.TemporalType temporalType) |
<P> QueryImplementor |
setParameter(javax.persistence.Parameter<P> parameter,
P value) |
QueryImplementor<R> |
setParameter(javax.persistence.Parameter<java.time.ZonedDateTime> param,
java.time.ZonedDateTime value,
javax.persistence.TemporalType temporalType) |
<P> QueryImplementor |
setParameter(QueryParameter<P> parameter,
P value)
Bind a query parameter using its inferred Type.
|
<P> QueryImplementor |
setParameter(QueryParameter<P> parameter,
P value,
javax.persistence.TemporalType temporalType)
Bind a query parameter as some form of date/time using the indicated
temporal-type.
|
<P> QueryImplementor |
setParameter(QueryParameter<P> parameter,
P value,
Type type)
Bind a query parameter using the supplied Type
|
QueryImplementor |
setParameter(java.lang.String name,
java.util.Calendar value,
javax.persistence.TemporalType temporalType) |
QueryImplementor |
setParameter(java.lang.String name,
java.util.Date value,
javax.persistence.TemporalType temporalType) |
QueryImplementor<R> |
setParameter(java.lang.String name,
java.time.Instant value,
javax.persistence.TemporalType temporalType) |
QueryImplementor<R> |
setParameter(java.lang.String name,
java.time.LocalDateTime value,
javax.persistence.TemporalType temporalType) |
QueryImplementor |
setParameter(java.lang.String name,
java.lang.Object value)
Bind a named query parameter using its inferred Type.
|
QueryImplementor |
setParameter(java.lang.String name,
java.lang.Object value,
javax.persistence.TemporalType temporalType)
Bind a named query parameter as some form of date/time using
the indicated temporal-type.
|
QueryImplementor |
setParameter(java.lang.String name,
java.lang.Object value,
Type type)
Bind a named query parameter using the supplied Type
|
QueryImplementor<R> |
setParameter(java.lang.String name,
java.time.OffsetDateTime value,
javax.persistence.TemporalType temporalType) |
QueryImplementor<R> |
setParameter(java.lang.String name,
java.time.ZonedDateTime value,
javax.persistence.TemporalType temporalType) |
<P> QueryImplementor<R> |
setParameterList(QueryParameter<P> parameter,
java.util.Collection<P> values)
Bind multiple values to a query parameter using its inferred Type.
|
QueryImplementor |
setParameterList(java.lang.String name,
java.util.Collection values)
Bind multiple values to a named query parameter.
|
QueryImplementor |
setParameterList(java.lang.String name,
java.util.Collection values,
Type type)
Bind multiple values to a named query parameter.
|
QueryImplementor |
setParameterList(java.lang.String name,
java.lang.Object[] values)
Bind multiple values to a named query parameter.
|
QueryImplementor |
setParameterList(java.lang.String name,
java.lang.Object[] values,
Type type)
Bind multiple values to a named query parameter.
|
QueryImplementor |
setProperties(java.util.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.
|
QueryImplementor |
setProperties(java.lang.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.
|
QueryImplementor |
setReadOnly(boolean readOnly)
Set the read-only/modifiable mode for entities and proxies
loaded by this Query.
|
QueryImplementor |
setResultTransformer(ResultTransformer transformer)
Set a strategy for handling the query results.
|
QueryImplementor |
setTimeout(int timeout)
Set the query timeout in seconds.
|
java.util.stream.Stream<R> |
stream()
Retrieve a Stream over the query results.
|
static <R> R |
uniqueElement(java.util.List<R> list) |
R |
uniqueResult()
Convenience method to return a single instance that matches
the query, or
null if the query returns no results. |
java.util.Optional<R> |
uniqueResultOptional() |
<T> T |
unwrap(java.lang.Class<T> cls) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getQueryString, getResultList, getResultStream, 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, setSerializable, setSerializable, setShort, setShort, setString, setString, setText, setText, setTime, setTime, setTimestamp, setTimestamp
getReturnAliases, getReturnTypes
public AbstractProducedQuery(SharedSessionContractImplementor producer, ParameterMetadata parameterMetadata)
public SharedSessionContractImplementor getProducer()
Query
getProducer
in interface QueryImplementor<R>
public FlushMode getHibernateFlushMode()
Query
getHibernateFlushMode
in interface BasicQueryContract
FlushMode
public QueryImplementor setHibernateFlushMode(FlushMode flushMode)
Query
setHibernateFlushMode
in interface BasicQueryContract
flushMode
- The new FlushMode to use.this
, for method chainingQuery.getHibernateFlushMode()
public QueryImplementor setFlushMode(FlushMode flushMode)
Query
setFlushMode
in interface BasicQueryContract
flushMode
- The new FlushMode to use.this
, for method chainingQuery.getHibernateFlushMode()
public javax.persistence.FlushModeType getFlushMode()
Query
FlushModeType
rather than Hibernate's FlushMode
. For
the former behavior, use Query.getHibernateFlushMode()
instead.getFlushMode
in interface javax.persistence.Query
public QueryImplementor setFlushMode(javax.persistence.FlushModeType flushModeType)
setFlushMode
in interface javax.persistence.Query
setFlushMode
in interface javax.persistence.TypedQuery<R>
public CacheMode getCacheMode()
Query
getCacheMode
in interface BasicQueryContract
Session.getCacheMode()
,
CacheMode
public QueryImplementor setCacheMode(CacheMode cacheMode)
Query
setCacheMode
in interface BasicQueryContract
cacheMode
- The new CacheMode to use.this
, for method chainingQuery.getCacheMode()
public boolean isCacheable()
Query
SessionFactory
for this to happen. Usually that is
controlled by the hibernate.cache.use_query_cache
configuration setting.isCacheable
in interface BasicQueryContract
true
if the query results are eligible for caching, false
otherwise.AvailableSettings.USE_QUERY_CACHE
public QueryImplementor setCacheable(boolean cacheable)
Query
setCacheable
in interface BasicQueryContract
cacheable
- Should the query results be cacheable?this
, for method chainingQuery.isCacheable()
public java.lang.String getCacheRegion()
Query
Query.isCacheable()
for more information). null
indicates that the
default region should be used.getCacheRegion
in interface BasicQueryContract
null
indicates
the default region.public QueryImplementor setCacheRegion(java.lang.String cacheRegion)
Query
setCacheRegion
in interface BasicQueryContract
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 java.lang.Integer getTimeout()
Query
Statement.setQueryTimeout(int)
. Zero indicates no timeout.getTimeout
in interface BasicQueryContract
Statement.getQueryTimeout()
,
Statement.setQueryTimeout(int)
public QueryImplementor setTimeout(int timeout)
Query
setTimeout
in interface BasicQueryContract
timeout
- the timeout in secondsthis
, for method chainingQuery.getTimeout()
public java.lang.Integer getFetchSize()
Query
Statement.setFetchSize(int)
. As defined b y JDBC, this value is a hint to the
driver to indicate how many rows to fetch from the database when more rows are needed.
NOTE : JDBC expressly defines this value as a hint. It may or may not have any effect on the actual
query execution and ResultSet processing depending on the driver.getFetchSize
in interface BasicQueryContract
Statement.getFetchSize()
,
Statement.setFetchSize(int)
public QueryImplementor setFetchSize(int fetchSize)
Query
setFetchSize
in interface BasicQueryContract
fetchSize
- the fetch size hintthis
, for method chainingQuery.getFetchSize()
public boolean isReadOnly()
Query
isReadOnly
in interface BasicQueryContract
true
if the entities and proxies loaded by the query will be put
in read-only mode; false
otherwise (they will be modifiable)Query.setReadOnly(boolean)
,
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 QueryImplementor setReadOnly(boolean readOnly)
Query
setReadOnly
in interface BasicQueryContract
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 LockOptions getLockOptions()
Query
LockOptions
public QueryImplementor setLockOptions(LockOptions lockOptions)
Query
Query.setLockMode(String, LockMode)
.lockOptions
- The lock options to apply to the query.this
, for method chainingQuery.getLockOptions()
public QueryImplementor setLockMode(java.lang.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
).alias
- a query alias, or "this"
for a collection filterlockMode
- The lock mode to apply.this
, for method chainingQuery.getLockOptions()
public QueryImplementor setLockMode(javax.persistence.LockModeType lockModeType)
setLockMode
in interface javax.persistence.Query
setLockMode
in interface javax.persistence.TypedQuery<R>
public java.lang.String getComment()
Query
hibernate.use_sql_comments
config setting), this comment will also be added
to the SQL query sent to the database. Often useful for identifying the source of troublesome queries on the
database side.public QueryImplementor setComment(java.lang.String comment)
Query
comment
- The human-readable commentthis
, for method chainingQuery.getComment()
public QueryImplementor addQueryHint(java.lang.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.hint
- The database specific query hint to add.public ParameterMetadata getParameterMetadata()
Query
public java.lang.String[] getNamedParameters()
Query
public QueryImplementor<R> setParameter(javax.persistence.Parameter<java.time.Instant> param, java.time.Instant value, javax.persistence.TemporalType temporalType)
public QueryImplementor<R> setParameter(javax.persistence.Parameter<java.time.LocalDateTime> param, java.time.LocalDateTime value, javax.persistence.TemporalType temporalType)
public QueryImplementor<R> setParameter(javax.persistence.Parameter<java.time.ZonedDateTime> param, java.time.ZonedDateTime value, javax.persistence.TemporalType temporalType)
public QueryImplementor<R> setParameter(javax.persistence.Parameter<java.time.OffsetDateTime> param, java.time.OffsetDateTime value, javax.persistence.TemporalType temporalType)
public QueryImplementor<R> setParameter(java.lang.String name, java.time.Instant value, javax.persistence.TemporalType temporalType)
public QueryImplementor<R> setParameter(java.lang.String name, java.time.LocalDateTime value, javax.persistence.TemporalType temporalType)
public QueryImplementor<R> setParameter(java.lang.String name, java.time.ZonedDateTime value, javax.persistence.TemporalType temporalType)
public QueryImplementor<R> setParameter(java.lang.String name, java.time.OffsetDateTime value, javax.persistence.TemporalType temporalType)
public QueryImplementor<R> setParameter(int position, java.time.Instant value, javax.persistence.TemporalType temporalType)
public QueryImplementor<R> setParameter(int position, java.time.LocalDateTime value, javax.persistence.TemporalType temporalType)
public QueryImplementor<R> setParameter(int position, java.time.ZonedDateTime value, javax.persistence.TemporalType temporalType)
public QueryImplementor<R> setParameter(int position, java.time.OffsetDateTime value, javax.persistence.TemporalType temporalType)
public <P> QueryImplementor setParameter(QueryParameter<P> parameter, P value)
Query
Query.setParameter(QueryParameter, Object, Type)
should be used insteadparameter
- The query parameter mementovalue
- the possibly-null parameter valuethis
, for method chainingpublic <P> QueryImplementor setParameter(javax.persistence.Parameter<P> parameter, P value)
setParameter
in interface javax.persistence.Query
setParameter
in interface javax.persistence.TypedQuery<R>
public QueryImplementor setParameter(java.lang.String name, java.lang.Object value)
Query
Query.setParameter(String, Object, Type)
should be used insteadsetParameter
in interface javax.persistence.Query
setParameter
in interface javax.persistence.TypedQuery<R>
name
- the parameter namevalue
- the (possibly-null) parameter valuethis
, for method chainingpublic QueryImplementor setParameter(int position, java.lang.Object value)
Query
Query.setParameter(int, Object, Type)
should be used insteadsetParameter
in interface javax.persistence.Query
setParameter
in interface javax.persistence.TypedQuery<R>
position
- the position of the parameter in the query
string, numbered from 0.value
- the possibly-null parameter valuethis
, for method chainingpublic <P> QueryImplementor setParameter(QueryParameter<P> parameter, P value, Type type)
Query
parameter
- The query parameter mementovalue
- the possibly-null parameter valuetype
- the Hibernate typethis
, for method chainingpublic QueryImplementor setParameter(java.lang.String name, java.lang.Object value, Type type)
Query
name
- the name of the parametervalue
- the possibly-null parameter valuetype
- the Hibernate typethis
, for method chainingpublic QueryImplementor setParameter(int position, java.lang.Object value, Type type)
Query
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> QueryImplementor setParameter(QueryParameter<P> parameter, P value, javax.persistence.TemporalType temporalType)
Query
parameter
- The query parameter mementovalue
- the possibly-null parameter valuetemporalType
- the temporal-type to use in binding the date/timethis
, for method chainingpublic QueryImplementor setParameter(java.lang.String name, java.lang.Object value, javax.persistence.TemporalType temporalType)
Query
name
- the parameter namevalue
- the possibly-null parameter valuetemporalType
- the temporal-type to use in binding the date/timethis
, for method chainingpublic QueryImplementor setParameter(int position, java.lang.Object value, javax.persistence.TemporalType temporalType)
Query
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 <P> QueryImplementor<R> setParameterList(QueryParameter<P> parameter, java.util.Collection<P> values)
Query
parameter
- the parameter mementovalues
- a collection of values to listthis
, for method chainingpublic QueryImplementor setParameterList(java.lang.String name, java.util.Collection values)
Query
name
- the name of the parametervalues
- a collection of values to listthis
, for method chainingpublic QueryImplementor setParameterList(java.lang.String name, java.util.Collection values, Type type)
Query
name
- the name of the parametervalues
- a collection of values to listtype
- the Hibernate type of the valuesthis
, for method chainingpublic QueryImplementor setParameterList(java.lang.String name, java.lang.Object[] values, Type type)
Query
name
- the name of the parametervalues
- a collection of values to listtype
- the Hibernate type of the valuesthis
, for method chainingpublic QueryImplementor setParameterList(java.lang.String name, java.lang.Object[] values)
Query
name
- the name of the parametervalues
- a collection of values to listthis
, for method chainingpublic QueryImplementor setParameter(javax.persistence.Parameter<java.util.Calendar> param, java.util.Calendar value, javax.persistence.TemporalType temporalType)
setParameter
in interface javax.persistence.Query
setParameter
in interface javax.persistence.TypedQuery<R>
public QueryImplementor setParameter(javax.persistence.Parameter<java.util.Date> param, java.util.Date value, javax.persistence.TemporalType temporalType)
setParameter
in interface javax.persistence.Query
setParameter
in interface javax.persistence.TypedQuery<R>
public QueryImplementor setParameter(java.lang.String name, java.util.Calendar value, javax.persistence.TemporalType temporalType)
setParameter
in interface javax.persistence.Query
setParameter
in interface javax.persistence.TypedQuery<R>
public QueryImplementor setParameter(java.lang.String name, java.util.Date value, javax.persistence.TemporalType temporalType)
setParameter
in interface javax.persistence.Query
setParameter
in interface javax.persistence.TypedQuery<R>
public QueryImplementor setParameter(int position, java.util.Calendar value, javax.persistence.TemporalType temporalType)
setParameter
in interface javax.persistence.Query
setParameter
in interface javax.persistence.TypedQuery<R>
public QueryImplementor setParameter(int position, java.util.Date value, javax.persistence.TemporalType temporalType)
setParameter
in interface javax.persistence.Query
setParameter
in interface javax.persistence.TypedQuery<R>
public java.util.Set<javax.persistence.Parameter<?>> getParameters()
getParameters
in interface javax.persistence.Query
public javax.persistence.Parameter<?> getParameter(java.lang.String name)
getParameter
in interface javax.persistence.Query
public <T> javax.persistence.Parameter<T> getParameter(java.lang.String name, java.lang.Class<T> type)
getParameter
in interface javax.persistence.Query
public javax.persistence.Parameter<?> getParameter(int position)
getParameter
in interface javax.persistence.Query
public <T> javax.persistence.Parameter<T> getParameter(int position, java.lang.Class<T> type)
getParameter
in interface javax.persistence.Query
public boolean isBound(javax.persistence.Parameter<?> parameter)
isBound
in interface javax.persistence.Query
public <T> T getParameterValue(javax.persistence.Parameter<T> parameter)
getParameterValue
in interface javax.persistence.Query
public java.lang.Object getParameterValue(java.lang.String name)
getParameterValue
in interface javax.persistence.Query
public java.lang.Object getParameterValue(int position)
getParameterValue
in interface javax.persistence.Query
public QueryImplementor setProperties(java.lang.Object bean)
Query
bean
- any JavaBean or POJOthis
, for method chainingprotected Type determineType(java.lang.String namedParam, java.lang.Class retType)
public QueryImplementor setProperties(java.util.Map map)
Query
map
- a java.util.Mapthis
, for method chainingpublic QueryImplementor setResultTransformer(ResultTransformer transformer)
Query
transformer
- The transformer to applypublic RowSelection getQueryOptions()
Query
public int getMaxResults()
getMaxResults
in interface javax.persistence.Query
public QueryImplementor setMaxResults(int maxResult)
setMaxResults
in interface javax.persistence.Query
setMaxResults
in interface javax.persistence.TypedQuery<R>
public int getFirstResult()
getFirstResult
in interface javax.persistence.Query
public QueryImplementor setFirstResult(int startPosition)
setFirstResult
in interface javax.persistence.Query
setFirstResult
in interface javax.persistence.TypedQuery<R>
public java.util.Set<java.lang.String> getSupportedHints()
public java.util.Map<java.lang.String,java.lang.Object> getHints()
getHints
in interface javax.persistence.Query
protected void collectBaselineHints(java.util.Map<java.lang.String,java.lang.Object> hints)
protected void collectHints(java.util.Map<java.lang.String,java.lang.Object> hints)
protected void putIfNotNull(java.util.Map<java.lang.String,java.lang.Object> hints, java.lang.String hintName, java.lang.Enum hintValue)
protected void putIfNotNull(java.util.Map<java.lang.String,java.lang.Object> hints, java.lang.String hintName, java.lang.Object hintValue)
public QueryImplementor setHint(java.lang.String hintName, java.lang.Object value)
setHint
in interface javax.persistence.Query
setHint
in interface javax.persistence.TypedQuery<R>
protected boolean applyJpaCacheRetrieveMode(javax.persistence.CacheRetrieveMode mode)
protected boolean applyJpaCacheStoreMode(javax.persistence.CacheStoreMode storeMode)
protected boolean applyNativeQueryLockMode(java.lang.Object value)
protected boolean applyTimeoutHint(int timeout)
timeout
- The timeout (in seconds!) specified as a hinttrue
if the hint was "applied"protected boolean applyLockTimeoutHint(int timeout)
timeout
- The timeout (in seconds!) specified as a hinttrue
if the hint was "applied"protected boolean applyCommentHint(java.lang.String comment)
comment
- The comment specified as a hinttrue
if the hint was "applied"protected boolean applyFetchSizeHint(int fetchSize)
fetchSize
- The fetch size specified as a hinttrue
if the hint was "applied"protected boolean applyCacheableHint(boolean isCacheable)
isCacheable
- The value specified as hinttrue
if the hint was "applied"protected boolean applyCacheRegionHint(java.lang.String regionName)
regionName
- The name of the cache region specified as a hinttrue
if the hint was "applied"protected boolean applyReadOnlyHint(boolean isReadOnly)
isReadOnly
- The value specified as hinttrue
if the hint was "applied"protected boolean applyCacheModeHint(CacheMode cacheMode)
cacheMode
- The CacheMode value specified as a hint.true
if the hint was "applied"protected boolean applyFlushModeHint(FlushMode flushMode)
flushMode
- The FlushMode value specified as hinttrue
if the hint was "applied"protected boolean canApplyAliasSpecificLockModeHints()
true
indicates they can be applied, false
otherwise.protected boolean applyLockModeTypeHint(javax.persistence.LockModeType lockModeType)
protected boolean applyHibernateLockModeHint(LockMode lockMode)
protected void applyAliasSpecificLockModeHint(java.lang.String alias, LockMode lockMode)
canApplyAliasSpecificLockModeHints()
has already been
called and returned true
.alias
- The alias to apply the 'lockMode' to.lockMode
- The LockMode to apply.protected void applyEntityGraphQueryHint(EntityGraphQueryHint hint)
hint
- The entity graph hint objectprotected boolean applyFollowOnLockingHint(java.lang.Boolean followOnLocking)
followOnLocking
- The follow-on-locking strategy.protected boolean applyPassDistinctThrough(boolean passDistinctThrough)
passDistinctThrough
- the query passes distinct
to the databaseprotected abstract boolean isNativeQuery()
true
if it is a native query; false
otherwisepublic javax.persistence.LockModeType getLockMode()
getLockMode
in interface javax.persistence.Query
public <T> T unwrap(java.lang.Class<T> cls)
unwrap
in interface javax.persistence.Query
public QueryParameters getQueryParameters()
protected Type[] getPositionalParameterTypes()
protected java.lang.Object[] getPositionalParameterValues()
protected java.util.Map<java.lang.String,TypedValue> getNamedParameterMap()
protected void beforeQuery()
protected void afterQuery()
public java.util.Iterator<R> iterate()
Query
protected java.util.Iterator<R> doIterate()
public ScrollableResultsImplementor scroll()
Query
You should call ScrollableResults.close()
after processing the ScrollableResults
so that the underlying resources are deallocated right away.
ScrollableResults
public ScrollableResultsImplementor scroll(ScrollMode scrollMode)
Query
You should call ScrollableResults.close()
after processing the ScrollableResults
so that the underlying resources are deallocated right away.
scrollMode
- The scroll modeScrollableResults
,
ScrollMode
protected ScrollableResultsImplementor doScroll(ScrollMode scrollMode)
public java.util.stream.Stream<R> stream()
Query
You should call BaseStream.close()
after processing the stream
so that the underlying resources are deallocated right away.
public java.util.Optional<R> uniqueResultOptional()
public java.util.List<R> list()
Query
protected boolean isCallable()
protected java.util.List<R> doList()
public QueryParameterBindingsImpl getQueryParameterBindings()
public R uniqueResult()
Query
null
if the query returns no results.public R getSingleResult()
getSingleResult
in interface javax.persistence.Query
getSingleResult
in interface javax.persistence.TypedQuery<R>
public static <R> R uniqueElement(java.util.List<R> list) throws NonUniqueResultException
NonUniqueResultException
public int executeUpdate() throws HibernateException
executeUpdate
in interface javax.persistence.Query
HibernateException
protected int doExecuteUpdate()
protected java.lang.String resolveEntityName(java.lang.Object val)
public void setOptionalEntityName(java.lang.String optionalEntityName)
setOptionalEntityName
in interface QueryImplementor<R>
public void setOptionalId(java.io.Serializable optionalId)
setOptionalId
in interface QueryImplementor<R>
public void setOptionalObject(java.lang.Object optionalObject)
setOptionalObject
in interface QueryImplementor<R>
public Type determineProperBooleanType(java.lang.String name, java.lang.Object value, Type defaultType)
public Type determineProperBooleanType(int position, java.lang.Object value, Type defaultType)
protected ExceptionConverter getExceptionConverter()
Copyright © 2001-2018 Red Hat, Inc. All Rights Reserved.