public abstract class BaseQueryImpl extends Object implements Query
Query
implementations, including
TypedQuery
and StoredProcedureQuery
. Care should be taken
that all changes here fit with all those usages.Modifier and Type | Class and Description |
---|---|
protected static class |
BaseQueryImpl.ParameterBindImpl<T> |
Constructor and Description |
---|
BaseQueryImpl(HibernateEntityManagerImplementor entityManager) |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
applyAliasSpecificLockModeHint(String alias,
LockMode lockMode)
Apply the alias specific lock modes.
|
protected abstract boolean |
applyCacheableHint(boolean isCacheable)
Apply the cacheable (true/false) hint.
|
protected abstract boolean |
applyCacheModeHint(CacheMode cacheMode)
Apply the CacheMode hint.
|
protected abstract boolean |
applyCacheRegionHint(String regionName)
Apply the cache region hint
|
protected abstract boolean |
applyCommentHint(String comment)
Apply the comment hint.
|
protected abstract boolean |
applyFetchSizeHint(int fetchSize)
Apply the fetch size hint
|
protected abstract void |
applyFirstResult(int firstResult)
Apply the given first-result value.
|
protected abstract boolean |
applyFlushModeHint(FlushMode flushMode)
Apply the FlushMode hint.
|
protected abstract boolean |
applyLockTimeoutHint(int timeout)
Apply the lock timeout (in seconds!) hint
|
protected abstract void |
applyMaxResults(int maxResults)
Apply the given max results value.
|
protected abstract boolean |
applyReadOnlyHint(boolean isReadOnly)
Apply the read-only (true/false) hint.
|
protected abstract boolean |
applyTimeoutHint(int timeout)
Apply the query timeout hint.
|
protected abstract boolean |
canApplyAliasSpecificLockModeHints()
Can alias-specific lock modes be applied?
|
protected void |
checkOpen(boolean markForRollbackIfClosed) |
protected HibernateEntityManagerImplementor |
entityManager() |
protected <X> ParameterRegistration<X> |
findParameterRegistration(int parameterPosition) |
protected <X> ParameterRegistration<X> |
findParameterRegistration(Parameter<X> parameter) |
protected <X> ParameterRegistration<X> |
findParameterRegistration(String parameterName) |
protected EntityGraphQueryHint |
getEntityGraphQueryHint() |
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.
|
Map<String,Object> |
getHints()
Get the properties and hints and associated values that are
in effect for the query instance.
|
int |
getMaxResults()
The maximum number of results the query object was set to
retrieve.
|
Parameter<?> |
getParameter(int position)
Get the parameter object corresponding to the declared
positional parameter with the given position.
|
<T> Parameter<T> |
getParameter(int position,
Class<T> type)
Get the parameter object corresponding to the declared
positional parameter with the given position and type.
|
Parameter<?> |
getParameter(String name)
Get the parameter object corresponding to the declared
parameter of the given name.
|
<T> Parameter<T> |
getParameter(String name,
Class<T> type)
Get the parameter object corresponding to the declared
parameter of the given name and type.
|
Set |
getParameters()
Get the parameter objects corresponding to the declared
parameters of the query.
|
Object |
getParameterValue(int position)
Return the value bound to the positional parameter.
|
<T> T |
getParameterValue(Parameter<T> param)
Return the value bound to the parameter.
|
Object |
getParameterValue(String name)
Return the value bound to the named parameter.
|
protected FlushModeType |
getSpecifiedFlushMode() |
int |
getSpecifiedMaxResults() |
Set<String> |
getSupportedHints() |
protected abstract void |
internalApplyLockMode(LockModeType lockModeType) |
boolean |
isBound(Parameter<?> param)
Return a boolean indicating whether a value has been bound
to the parameter.
|
protected abstract boolean |
isNativeSqlQuery()
Is the query represented here a native SQL query?
|
protected abstract boolean |
isSelectQuery()
Is the query represented here a SELECT query?
|
protected void |
registerParameter(ParameterRegistration parameter) |
BaseQueryImpl |
setFirstResult(int firstResult)
Set the position of the first result to retrieve.
|
BaseQueryImpl |
setFlushMode(FlushModeType jpaFlushMode)
Set the flush mode type to be used for the query execution.
|
BaseQueryImpl |
setHint(String hintName,
Object value)
Set a query property or hint.
|
BaseQueryImpl |
setMaxResults(int maxResult)
Set the maximum number of results to retrieve.
|
BaseQueryImpl |
setParameter(int position,
Calendar value,
TemporalType temporalType)
Bind an instance of
java.util.Calendar to a positional
parameter. |
BaseQueryImpl |
setParameter(int position,
Date value,
TemporalType temporalType)
Bind an instance of
java.util.Date to a positional parameter. |
BaseQueryImpl |
setParameter(int position,
Object value)
Bind an argument to a positional parameter.
|
BaseQueryImpl |
setParameter(Parameter<Calendar> param,
Calendar value,
TemporalType temporalType)
Bind an instance of
java.util.Calendar to a Parameter object. |
BaseQueryImpl |
setParameter(Parameter<Date> param,
Date value,
TemporalType temporalType)
Bind an instance of
java.util.Date to a Parameter object. |
<T> BaseQueryImpl |
setParameter(Parameter<T> param,
T value)
Bind the value of a
Parameter object. |
BaseQueryImpl |
setParameter(String name,
Calendar value,
TemporalType temporalType)
Bind an instance of
java.util.Calendar to a named parameter. |
BaseQueryImpl |
setParameter(String name,
Date value,
TemporalType temporalType)
Bind an instance of
java.util.Date to a named parameter. |
BaseQueryImpl |
setParameter(String name,
Object value)
Bind an argument to a named parameter.
|
protected static void |
validateBinding(Class parameterType,
Object bind,
TemporalType temporalType) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
executeUpdate, getLockMode, getResultList, getSingleResult, setLockMode, unwrap
public BaseQueryImpl(HibernateEntityManagerImplementor entityManager)
protected HibernateEntityManagerImplementor entityManager()
protected void checkOpen(boolean markForRollbackIfClosed)
protected abstract void applyFirstResult(int firstResult)
firstResult
- The specified first-result value.public BaseQueryImpl setFirstResult(int firstResult)
Query
setFirstResult
in interface Query
firstResult
- position of the first result,
numbered from 0public int getFirstResult()
Query
setFirstResult
was not applied to the
query object.getFirstResult
in interface Query
protected abstract void applyMaxResults(int maxResults)
maxResults
- The specified max resultspublic BaseQueryImpl setMaxResults(int maxResult)
Query
setMaxResults
in interface Query
maxResult
- maximum number of results to retrievepublic int getSpecifiedMaxResults()
public int getMaxResults()
Query
Integer.MAX_VALUE
if setMaxResults
was not
applied to the query object.getMaxResults
in interface Query
public Map<String,Object> getHints()
Query
protected abstract boolean applyTimeoutHint(int timeout)
timeout
- The timeout (in seconds!) specified as a hinttrue
if the hint was "applied"protected abstract boolean applyLockTimeoutHint(int timeout)
timeout
- The timeout (in seconds!) specified as a hinttrue
if the hint was "applied"protected abstract boolean applyCommentHint(String comment)
comment
- The comment specified as a hinttrue
if the hint was "applied"protected abstract boolean applyFetchSizeHint(int fetchSize)
fetchSize
- The fetch size specified as a hinttrue
if the hint was "applied"protected abstract boolean applyCacheableHint(boolean isCacheable)
isCacheable
- The value specified as hinttrue
if the hint was "applied"protected abstract boolean applyCacheRegionHint(String regionName)
regionName
- The name of the cache region specified as a hinttrue
if the hint was "applied"protected abstract boolean applyReadOnlyHint(boolean isReadOnly)
isReadOnly
- The value specified as hinttrue
if the hint was "applied"protected abstract boolean applyCacheModeHint(CacheMode cacheMode)
cacheMode
- The CacheMode value specified as a hint.true
if the hint was "applied"protected abstract boolean applyFlushModeHint(FlushMode flushMode)
flushMode
- The FlushMode value specified as hinttrue
if the hint was "applied"protected abstract boolean canApplyAliasSpecificLockModeHints()
true
indicates they can be applied, false
otherwise.protected abstract 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.public BaseQueryImpl setHint(String hintName, Object value)
Query
protected abstract boolean isNativeSqlQuery()
true
if it is a native SQL query; false
otherwiseprotected abstract boolean isSelectQuery()
true
if the query is a SELECT; false
otherwise.protected abstract void internalApplyLockMode(LockModeType lockModeType)
public BaseQueryImpl setFlushMode(FlushModeType jpaFlushMode)
Query
setFlushMode
in interface Query
jpaFlushMode
- flush modeprotected FlushModeType getSpecifiedFlushMode()
public FlushModeType getFlushMode()
Query
getFlushMode
in interface Query
protected <X> ParameterRegistration<X> findParameterRegistration(Parameter<X> parameter)
protected <X> ParameterRegistration<X> findParameterRegistration(String parameterName)
protected <X> ParameterRegistration<X> findParameterRegistration(int parameterPosition)
protected void registerParameter(ParameterRegistration parameter)
public <T> BaseQueryImpl setParameter(Parameter<T> param, T value)
Query
Parameter
object.setParameter
in interface Query
param
- parameter objectvalue
- parameter valuepublic BaseQueryImpl setParameter(Parameter<Calendar> param, Calendar value, TemporalType temporalType)
Query
java.util.Calendar
to a Parameter
object.setParameter
in interface Query
param
- parameter objectvalue
- parameter valuetemporalType
- temporal typepublic BaseQueryImpl setParameter(Parameter<Date> param, Date value, TemporalType temporalType)
Query
java.util.Date
to a Parameter
object.setParameter
in interface Query
param
- parameter objectvalue
- parameter valuetemporalType
- temporal typepublic BaseQueryImpl setParameter(String name, Object value)
Query
setParameter
in interface Query
name
- parameter namevalue
- parameter valuepublic BaseQueryImpl setParameter(String name, Calendar value, TemporalType temporalType)
Query
java.util.Calendar
to a named parameter.setParameter
in interface Query
name
- parameter namevalue
- parameter valuetemporalType
- temporal typepublic BaseQueryImpl setParameter(String name, Date value, TemporalType temporalType)
Query
java.util.Date
to a named parameter.setParameter
in interface Query
name
- parameter namevalue
- parameter valuetemporalType
- temporal typepublic BaseQueryImpl setParameter(int position, Object value)
Query
setParameter
in interface Query
position
- positionvalue
- parameter valuepublic BaseQueryImpl setParameter(int position, Calendar value, TemporalType temporalType)
Query
java.util.Calendar
to a positional
parameter.setParameter
in interface Query
position
- positionvalue
- parameter valuetemporalType
- temporal typepublic BaseQueryImpl setParameter(int position, Date value, TemporalType temporalType)
Query
java.util.Date
to a positional parameter.setParameter
in interface Query
position
- positionvalue
- parameter valuetemporalType
- temporal typepublic Set getParameters()
Query
getParameters
in interface Query
public Parameter<?> getParameter(String name)
Query
getParameter
in interface Query
name
- parameter namepublic <T> Parameter<T> getParameter(String name, Class<T> type)
Query
getParameter
in interface Query
name
- parameter nametype
- typepublic Parameter<?> getParameter(int position)
Query
getParameter
in interface Query
position
- positionpublic <T> Parameter<T> getParameter(int position, Class<T> type)
Query
getParameter
in interface Query
position
- positiontype
- typepublic boolean isBound(Parameter<?> param)
Query
public <T> T getParameterValue(Parameter<T> param)
Query
getParameterValue
in interface Query
param
- parameter objectpublic Object getParameterValue(String name)
Query
getParameterValue
in interface Query
name
- parameter namepublic Object getParameterValue(int position)
Query
getParameterValue
in interface Query
position
- positionprotected EntityGraphQueryHint getEntityGraphQueryHint()
protected static void validateBinding(Class parameterType, Object bind, TemporalType temporalType)
Copyright © 2017 JBoss by Red Hat. All rights reserved.