public abstract class AbstractProducedQuery<R> extends Object implements QueryImplementor<R>
| Constructor and Description |
|---|
AbstractProducedQuery(SharedSessionContractImplementor producer,
ParameterMetadata parameterMetadata) |
| Modifier and Type | Method and Description |
|---|---|
QueryImplementor |
addQueryHint(String hint)
Add a DB query hint to the SQL.
|
protected void |
afterQuery() |
protected void |
applyAliasSpecificLockModeHint(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(String regionName)
Apply the cache region hint
|
protected boolean |
applyCommentHint(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(Boolean followOnLocking)
Apply the follow-on-locking hint.
|
protected boolean |
applyHibernateLockModeHint(LockMode lockMode) |
protected boolean |
applyJpaCacheRetrieveMode(CacheRetrieveMode mode) |
protected boolean |
applyJpaCacheStoreMode(CacheStoreMode storeMode) |
protected boolean |
applyLockModeTypeHint(LockModeType lockModeType) |
protected boolean |
applyLockTimeoutHint(int timeout)
Apply the lock timeout (in seconds!) hint
|
protected boolean |
applyNativeQueryLockMode(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(Map<String,Object> hints) |
protected void |
collectHints(Map<String,Object> hints) |
Type |
determineProperBooleanType(int position,
Object value,
Type defaultType) |
Type |
determineProperBooleanType(String name,
Object value,
Type defaultType) |
protected Type |
determineType(String namedParam,
Class retType) |
protected int |
doExecuteUpdate() |
protected Iterator<R> |
doIterate() |
protected List<R> |
doList() |
protected ScrollableResultsImplementor |
doScroll(ScrollMode scrollMode) |
int |
executeUpdate()
Execute an update or delete statement.
|
CacheMode |
getCacheMode()
Obtain the CacheMode in effect for this query.
|
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). |
String |
getComment()
Obtain the comment currently associated with this query.
|
protected ExceptionConverter |
getExceptionConverter() |
Integer |
getFetchSize()
Obtain the JDBC fetch size hint in effect for this query.
|
int |
getFirstResult()
The position of the first result the query object was set to
retrieve.
|
FlushModeType |
getFlushMode()
Get the flush mode in effect for the query execution.
|
FlushMode |
getHibernateFlushMode()
Obtain the FlushMode in effect for this query.
|
Map<String,Object> |
getHints()
Get the properties and hints and associated values that are
in effect for the query instance.
|
LockModeType |
getLockMode()
Get the current lock mode for the query.
|
LockOptions |
getLockOptions()
Obtains the LockOptions in effect for this query.
|
int |
getMaxResults()
The maximum number of results the query object was set to
retrieve.
|
protected Map<String,TypedValue> |
getNamedParameterMap() |
String[] |
getNamedParameters()
Return the names of all named parameters of the query.
|
QueryParameter<?> |
getParameter(int position)
Get the parameter object corresponding to the declared
positional parameter with the given position.
|
<T> QueryParameter<T> |
getParameter(int position,
Class<T> type)
Get the parameter object corresponding to the declared
positional parameter with the given position and type.
|
QueryParameter<?> |
getParameter(String name)
Get the parameter object corresponding to the declared
parameter of the given name.
|
<T> QueryParameter<T> |
getParameter(String name,
Class<T> type)
Get the parameter object corresponding to the declared
parameter of the given name and type.
|
ParameterMetadata |
getParameterMetadata()
Access to information about query parameters.
|
Set<Parameter<?>> |
getParameters()
Get the parameter objects corresponding to the declared
parameters of the query.
|
Object |
getParameterValue(int position)
Return the input value bound to the positional parameter.
|
<T> T |
getParameterValue(Parameter<T> parameter)
Return the input value bound to the parameter.
|
Object |
getParameterValue(String name)
Return the input value bound to the named parameter.
|
protected Type[] |
getPositionalParameterTypes() |
protected Object[] |
getPositionalParameterValues() |
SharedSessionContractImplementor |
getProducer()
Get the QueryProducer this Query originates from.
|
RowSelection |
getQueryOptions()
"QueryOptions" is a better name, I think, than "RowSelection" -> 6.0
|
protected abstract QueryParameterBindings |
getQueryParameterBindings() |
QueryParameters |
getQueryParameters() |
R |
getSingleResult()
Execute a SELECT query that returns a single result.
|
Set<String> |
getSupportedHints() |
Integer |
getTimeout()
Obtain the query timeout in seconds.
|
protected void |
handleUnrecognizedHint(String hintName,
Object value) |
boolean |
isBound(Parameter<?> parameter)
Return a boolean indicating whether a value has been bound
to the 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.
|
Iterator<R> |
iterate()
Return the query results as an Iterator.
|
List<R> |
list()
Return the query results as a List.
|
protected QueryParameters |
makeQueryParametersForExecution(String hql) |
protected void |
putIfNotNull(Map<String,Object> hints,
String hintName,
Enum hintValue) |
protected void |
putIfNotNull(Map<String,Object> hints,
String hintName,
Object hintValue) |
protected String |
resolveEntityName(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(String cacheRegion)
Set the name of the cache region where query results should be cached (if cached at all).
|
QueryImplementor |
setComment(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)
Set the position of the first result to retrieve.
|
QueryImplementor |
setFlushMode(FlushMode flushMode)
(Re)set the current FlushMode in effect for this query.
|
QueryImplementor |
setFlushMode(FlushModeType flushModeType)
Set the flush mode type to be used for the query execution.
|
QueryImplementor |
setHibernateFlushMode(FlushMode flushMode)
(Re)set the current FlushMode in effect for this query.
|
QueryImplementor |
setHint(String hintName,
Object value)
Set a query property or hint.
|
QueryImplementor |
setLockMode(LockModeType lockModeType)
Set the lock mode type to be used for the query execution.
|
QueryImplementor |
setLockMode(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)
Set the maximum number of results to retrieve.
|
void |
setOptionalEntityName(String optionalEntityName) |
void |
setOptionalId(Serializable optionalId) |
void |
setOptionalObject(Object optionalObject) |
QueryImplementor |
setParameter(int position,
Calendar value,
TemporalType temporalType)
Bind an instance of
java.util.Calendar to a positional
parameter. |
QueryImplementor |
setParameter(int position,
Date value,
TemporalType temporalType)
Bind an instance of
java.util.Date to a positional parameter. |
QueryImplementor<R> |
setParameter(int position,
Instant value,
TemporalType temporalType) |
QueryImplementor<R> |
setParameter(int position,
LocalDateTime value,
TemporalType temporalType) |
QueryImplementor |
setParameter(int position,
Object value)
Bind an argument value to a positional parameter.
|
QueryImplementor |
setParameter(int position,
Object value,
TemporalType temporalType)
Bind a positional query parameter as some form of date/time using
the indicated temporal-type.
|
QueryImplementor |
setParameter(int position,
Object value,
Type type)
Bind a value to a JDBC-style query parameter.
|
QueryImplementor<R> |
setParameter(int position,
OffsetDateTime value,
TemporalType temporalType) |
QueryImplementor<R> |
setParameter(int position,
ZonedDateTime value,
TemporalType temporalType) |
QueryImplementor |
setParameter(Parameter<Calendar> param,
Calendar value,
TemporalType temporalType)
Bind an instance of
java.util.Calendar to a Parameter object. |
QueryImplementor |
setParameter(Parameter<Date> param,
Date value,
TemporalType temporalType)
Bind an instance of
java.util.Date to a Parameter object. |
QueryImplementor<R> |
setParameter(Parameter<Instant> param,
Instant value,
TemporalType temporalType) |
QueryImplementor<R> |
setParameter(Parameter<LocalDateTime> param,
LocalDateTime value,
TemporalType temporalType) |
QueryImplementor<R> |
setParameter(Parameter<OffsetDateTime> param,
OffsetDateTime value,
TemporalType temporalType) |
<P> QueryImplementor |
setParameter(Parameter<P> parameter,
P value)
Bind the value of a
Parameter object. |
QueryImplementor<R> |
setParameter(Parameter<ZonedDateTime> param,
ZonedDateTime value,
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,
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(String name,
Calendar value,
TemporalType temporalType)
Bind an instance of
java.util.Calendar to a named parameter. |
QueryImplementor |
setParameter(String name,
Date value,
TemporalType temporalType)
Bind an instance of
java.util.Date to a named parameter. |
QueryImplementor<R> |
setParameter(String name,
Instant value,
TemporalType temporalType) |
QueryImplementor<R> |
setParameter(String name,
LocalDateTime value,
TemporalType temporalType) |
QueryImplementor |
setParameter(String name,
Object value)
Bind an argument value to a named parameter.
|
QueryImplementor |
setParameter(String name,
Object value,
TemporalType temporalType)
Bind a named query parameter as some form of date/time using
the indicated temporal-type.
|
QueryImplementor |
setParameter(String name,
Object value,
Type type)
Bind a named query parameter using the supplied Type
|
QueryImplementor<R> |
setParameter(String name,
OffsetDateTime value,
TemporalType temporalType) |
QueryImplementor<R> |
setParameter(String name,
ZonedDateTime value,
TemporalType temporalType) |
QueryImplementor |
setParameterList(int position,
Collection values) |
QueryImplementor |
setParameterList(int position,
Collection values,
Type type) |
QueryImplementor |
setParameterList(int position,
Object[] values) |
QueryImplementor |
setParameterList(int position,
Object[] values,
Type type) |
<P> QueryImplementor<R> |
setParameterList(QueryParameter<P> parameter,
Collection<P> values)
Bind multiple values to a query parameter using its inferred Type.
|
QueryImplementor |
setParameterList(String name,
Collection values)
Bind multiple values to a named query parameter.
|
QueryImplementor |
setParameterList(String name,
Collection values,
Type type)
Bind multiple values to a named query parameter.
|
QueryImplementor |
setParameterList(String name,
Object[] values)
Bind multiple values to a named query parameter.
|
QueryImplementor |
setParameterList(String name,
Object[] values,
Type type)
Bind multiple values to a named query parameter.
|
QueryImplementor |
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.
|
QueryImplementor |
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.
|
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.
|
Stream<R> |
stream()
Retrieve a Stream over the query results.
|
static <R> R |
uniqueElement(List<R> list) |
R |
uniqueResult()
Convenience method to return a single instance that matches
the query, or
null if the query returns no results. |
Optional<R> |
uniqueResultOptional() |
<T> T |
unwrap(Class<T> cls)
Return an object of the specified type to allow access to
the provider-specific API.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetQueryString, 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, setTimestampgetHibernateFirstResult, getHibernateMaxResults, getReturnAliases, getReturnTypes, setHibernateFirstResult, setHibernateMaxResultspublic AbstractProducedQuery(SharedSessionContractImplementor producer, ParameterMetadata parameterMetadata)
public SharedSessionContractImplementor getProducer()
QuerygetProducer in interface QueryImplementor<R>public FlushMode getHibernateFlushMode()
QuerygetHibernateFlushMode in interface BasicQueryContract<CommonQueryContract>FlushModepublic QueryImplementor setHibernateFlushMode(FlushMode flushMode)
QuerysetHibernateFlushMode in interface BasicQueryContract<CommonQueryContract>flushMode - The new FlushMode to use.this, for method chainingQuery.getHibernateFlushMode()public QueryImplementor setFlushMode(FlushMode flushMode)
QuerysetFlushMode in interface BasicQueryContract<CommonQueryContract>flushMode - The new FlushMode to use.this, for method chainingQuery.getHibernateFlushMode()public FlushModeType getFlushMode()
QuerygetFlushMode in interface Querypublic QueryImplementor setFlushMode(FlushModeType flushModeType)
TypedQuerysetFlushMode in interface QuerysetFlushMode in interface TypedQuery<R>flushModeType - flush modepublic CacheMode getCacheMode()
QuerygetCacheMode in interface BasicQueryContract<CommonQueryContract>Session.getCacheMode(),
CacheModepublic QueryImplementor setCacheMode(CacheMode cacheMode)
QuerysetCacheMode in interface BasicQueryContract<CommonQueryContract>cacheMode - The new CacheMode to use.this, for method chainingQuery.getCacheMode()public boolean isCacheable()
QuerySessionFactory for this to happen. Usually that is
controlled by the hibernate.cache.use_query_cache configuration setting.isCacheable in interface BasicQueryContract<CommonQueryContract>true if the query results are eligible for caching, false otherwise.AvailableSettings.USE_QUERY_CACHEpublic QueryImplementor setCacheable(boolean cacheable)
QuerysetCacheable in interface BasicQueryContract<CommonQueryContract>cacheable - Should the query results be cacheable?this, for method chainingQuery.isCacheable()public String getCacheRegion()
QueryQuery.isCacheable() for more information). null indicates that the
default region should be used.getCacheRegion in interface BasicQueryContract<CommonQueryContract>null indicates
the default region.public QueryImplementor setCacheRegion(String cacheRegion)
QuerysetCacheRegion in interface BasicQueryContract<CommonQueryContract>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 Integer getTimeout()
QueryStatement.setQueryTimeout(int). Zero indicates no timeout.getTimeout in interface BasicQueryContract<CommonQueryContract>Statement.getQueryTimeout(),
Statement.setQueryTimeout(int)public QueryImplementor setTimeout(int timeout)
QuerysetTimeout in interface BasicQueryContract<CommonQueryContract>timeout - the timeout in secondsthis, for method chainingQuery.getTimeout()public Integer getFetchSize()
QueryStatement.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<CommonQueryContract>Statement.getFetchSize(),
Statement.setFetchSize(int)public QueryImplementor setFetchSize(int fetchSize)
QuerysetFetchSize in interface BasicQueryContract<CommonQueryContract>fetchSize - the fetch size hintthis, for method chainingQuery.getFetchSize()public boolean isReadOnly()
QueryisReadOnly in interface BasicQueryContract<CommonQueryContract>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)
QuerysetReadOnly in interface BasicQueryContract<CommonQueryContract>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()
QueryLockOptionspublic QueryImplementor setLockOptions(LockOptions lockOptions)
QueryQuery.setLockMode(String, LockMode).lockOptions - The lock options to apply to the query.this, for method chainingQuery.getLockOptions()public QueryImplementor setLockMode(String alias, LockMode lockMode)
QueryLockOptions.
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(LockModeType lockModeType)
TypedQuerysetLockMode in interface QuerysetLockMode in interface TypedQuery<R>lockModeType - lock modepublic String getComment()
Queryhibernate.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(String comment)
Querycomment - The human-readable commentthis, for method chainingQuery.getComment()public QueryImplementor addQueryHint(String hint)
QueryQueryHint, 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()
Querypublic String[] getNamedParameters()
Querypublic QueryImplementor<R> setParameter(Parameter<Instant> param, Instant value, TemporalType temporalType)
public QueryImplementor<R> setParameter(Parameter<LocalDateTime> param, LocalDateTime value, TemporalType temporalType)
public QueryImplementor<R> setParameter(Parameter<ZonedDateTime> param, ZonedDateTime value, TemporalType temporalType)
public QueryImplementor<R> setParameter(Parameter<OffsetDateTime> param, OffsetDateTime value, TemporalType temporalType)
public QueryImplementor<R> setParameter(String name, Instant value, TemporalType temporalType)
public QueryImplementor<R> setParameter(String name, LocalDateTime value, TemporalType temporalType)
public QueryImplementor<R> setParameter(String name, ZonedDateTime value, TemporalType temporalType)
public QueryImplementor<R> setParameter(String name, OffsetDateTime value, TemporalType temporalType)
public QueryImplementor<R> setParameter(int position, Instant value, TemporalType temporalType)
public QueryImplementor<R> setParameter(int position, LocalDateTime value, TemporalType temporalType)
public QueryImplementor<R> setParameter(int position, ZonedDateTime value, TemporalType temporalType)
public QueryImplementor<R> setParameter(int position, OffsetDateTime value, TemporalType temporalType)
public <P> QueryImplementor setParameter(QueryParameter<P> parameter, P value)
QueryQuery.setParameter(QueryParameter, Object, Type)
should be used insteadparameter - The query parameter mementovalue - the possibly-null parameter valuethis, for method chainingpublic <P> QueryImplementor setParameter(Parameter<P> parameter, P value)
TypedQueryParameter object.setParameter in interface QuerysetParameter in interface TypedQuery<R>parameter - parameter objectvalue - parameter valuepublic QueryImplementor setParameter(String name, Object value)
TypedQuerysetParameter in interface QuerysetParameter in interface TypedQuery<R>name - parameter namevalue - parameter valuepublic QueryImplementor setParameter(int position, Object value)
TypedQuerysetParameter in interface QuerysetParameter in interface TypedQuery<R>position - positionvalue - parameter valuepublic <P> QueryImplementor setParameter(QueryParameter<P> parameter, P value, Type type)
Queryparameter - The query parameter mementovalue - the possibly-null parameter valuetype - the Hibernate typethis, for method chainingpublic QueryImplementor setParameter(String name, Object value, Type type)
Queryname - the name of the parametervalue - the possibly-null parameter valuetype - the Hibernate typethis, for method chainingpublic QueryImplementor setParameter(int position, Object value, Type type)
Queryposition - 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, TemporalType temporalType)
Queryparameter - The query parameter mementovalue - the possibly-null parameter valuetemporalType - the temporal-type to use in binding the date/timethis, for method chainingpublic QueryImplementor setParameter(String name, Object value, TemporalType temporalType)
Queryname - 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, Object value, TemporalType temporalType)
Queryposition - 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, Collection<P> values)
Queryparameter - the parameter mementovalues - a collection of values to listthis, for method chainingpublic QueryImplementor setParameterList(String name, Collection values)
Queryname - the name of the parametervalues - a collection of values to listthis, for method chainingpublic QueryImplementor setParameterList(int position, Collection values)
public QueryImplementor setParameterList(String name, Collection values, Type type)
Queryname - the name of the parametervalues - a collection of values to listtype - the Hibernate type of the valuesthis, for method chainingpublic QueryImplementor setParameterList(int position, Collection values, Type type)
public QueryImplementor setParameterList(String name, Object[] values, Type type)
Queryname - the name of the parametervalues - a collection of values to listtype - the Hibernate type of the valuesthis, for method chainingpublic QueryImplementor setParameterList(int position, Object[] values, Type type)
public QueryImplementor setParameterList(String name, Object[] values)
Queryname - the name of the parametervalues - a collection of values to listthis, for method chainingpublic QueryImplementor setParameterList(int position, Object[] values)
public QueryImplementor setParameter(Parameter<Calendar> param, Calendar value, TemporalType temporalType)
TypedQueryjava.util.Calendar to a Parameter object.setParameter in interface QuerysetParameter in interface TypedQuery<R>param - parameter objectvalue - parameter valuetemporalType - temporal typepublic QueryImplementor setParameter(Parameter<Date> param, Date value, TemporalType temporalType)
TypedQueryjava.util.Date to a Parameter object.setParameter in interface QuerysetParameter in interface TypedQuery<R>param - parameter objectvalue - parameter valuetemporalType - temporal typepublic QueryImplementor setParameter(String name, Calendar value, TemporalType temporalType)
TypedQueryjava.util.Calendar to a named parameter.setParameter in interface QuerysetParameter in interface TypedQuery<R>name - parameter namevalue - parameter valuetemporalType - temporal typepublic QueryImplementor setParameter(String name, Date value, TemporalType temporalType)
TypedQueryjava.util.Date to a named parameter.setParameter in interface QuerysetParameter in interface TypedQuery<R>name - parameter namevalue - parameter valuetemporalType - temporal typepublic QueryImplementor setParameter(int position, Calendar value, TemporalType temporalType)
TypedQueryjava.util.Calendar to a positional
parameter.setParameter in interface QuerysetParameter in interface TypedQuery<R>position - positionvalue - parameter valuetemporalType - temporal typepublic QueryImplementor setParameter(int position, Date value, TemporalType temporalType)
TypedQueryjava.util.Date to a positional parameter.setParameter in interface QuerysetParameter in interface TypedQuery<R>position - positionvalue - parameter valuetemporalType - temporal typepublic Set<Parameter<?>> getParameters()
QuerygetParameters in interface Querypublic QueryParameter<?> getParameter(String name)
QuerygetParameter in interface Queryname - parameter namepublic <T> QueryParameter<T> getParameter(String name, Class<T> type)
QuerygetParameter in interface Queryname - parameter nametype - typepublic QueryParameter<?> getParameter(int position)
QuerygetParameter in interface Queryposition - positionpublic <T> QueryParameter<T> getParameter(int position, Class<T> type)
QuerygetParameter in interface Queryposition - positiontype - typepublic boolean isBound(Parameter<?> parameter)
Querypublic <T> T getParameterValue(Parameter<T> parameter)
QuerygetParameterValue in interface Queryparameter - parameter objectpublic Object getParameterValue(String name)
QuerygetParameterValue in interface Queryname - parameter namepublic Object getParameterValue(int position)
QuerygetParameterValue in interface Queryposition - positionpublic QueryImplementor setProperties(Object bean)
Querybean - any JavaBean or POJOthis, for method chainingpublic QueryImplementor setProperties(Map map)
Querymap - a java.util.Mapthis, for method chainingpublic QueryImplementor setResultTransformer(ResultTransformer transformer)
Querytransformer - The transformer to applypublic RowSelection getQueryOptions()
Querypublic int getMaxResults()
QueryInteger.MAX_VALUE if setMaxResults was not
applied to the query object.getMaxResults in interface Querypublic QueryImplementor setMaxResults(int maxResult)
TypedQuerysetMaxResults in interface QuerysetMaxResults in interface TypedQuery<R>maxResult - maximum number of results to retrievepublic int getFirstResult()
QuerysetFirstResult was not applied to the
query object.getFirstResult in interface Querypublic QueryImplementor setFirstResult(int startPosition)
TypedQuerysetFirstResult in interface QuerysetFirstResult in interface TypedQuery<R>startPosition - position of the first result,
numbered from 0public Map<String,Object> getHints()
Queryprotected void putIfNotNull(Map<String,Object> hints, String hintName, Object hintValue)
public QueryImplementor setHint(String hintName, Object value)
TypedQuerysetHint in interface QuerysetHint in interface TypedQuery<R>hintName - name of property or hintvalue - value for the property or hintprotected boolean applyJpaCacheRetrieveMode(CacheRetrieveMode mode)
protected boolean applyJpaCacheStoreMode(CacheStoreMode storeMode)
protected boolean applyNativeQueryLockMode(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(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(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(LockModeType lockModeType)
protected boolean applyHibernateLockModeHint(LockMode lockMode)
protected void applyAliasSpecificLockModeHint(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(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 LockModeType getLockMode()
QuerygetLockMode in interface Querypublic <T> T unwrap(Class<T> cls)
QueryPersistenceException is thrown.protected QueryParameters makeQueryParametersForExecution(String hql)
public QueryParameters getQueryParameters()
protected Type[] getPositionalParameterTypes()
protected Object[] getPositionalParameterValues()
protected Map<String,TypedValue> getNamedParameterMap()
protected void beforeQuery()
protected void afterQuery()
public Iterator<R> iterate()
Querypublic ScrollableResultsImplementor scroll()
Query
You should call ScrollableResults.close() after processing the ScrollableResults
so that the underlying resources are deallocated right away.
ScrollableResultspublic 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,
ScrollModeprotected ScrollableResultsImplementor doScroll(ScrollMode scrollMode)
public Stream<R> stream()
Query
You should call BaseStream.close() after processing the stream
so that the underlying resources are deallocated right away.
public List<R> list()
Queryprotected boolean isCallable()
protected abstract QueryParameterBindings getQueryParameterBindings()
public R uniqueResult()
Querynull if the query returns no results.public R getSingleResult()
TypedQuerygetSingleResult in interface QuerygetSingleResult in interface TypedQuery<R>public static <R> R uniqueElement(List<R> list) throws NonUniqueResultException
NonUniqueResultExceptionpublic int executeUpdate()
throws HibernateException
QueryexecuteUpdate in interface QueryHibernateExceptionprotected int doExecuteUpdate()
public void setOptionalEntityName(String optionalEntityName)
setOptionalEntityName in interface QueryImplementor<R>public void setOptionalId(Serializable optionalId)
setOptionalId in interface QueryImplementor<R>public void setOptionalObject(Object optionalObject)
setOptionalObject in interface QueryImplementor<R>public Type determineProperBooleanType(String name, Object value, Type defaultType)
public Type determineProperBooleanType(int position, Object value, Type defaultType)
protected ExceptionConverter getExceptionConverter()
Copyright © 2019 JBoss by Red Hat. All rights reserved.