public class QueryImpl<X> extends AbstractQueryImpl<X> implements TypedQuery<X>, HibernateQuery
Query
and TypedQuery
contracts.Modifier and Type | Field and Description |
---|---|
static EntityManagerMessageLogger |
LOG |
Constructor and Description |
---|
QueryImpl(Query query,
AbstractEntityManagerImpl em) |
QueryImpl(Query query,
AbstractEntityManagerImpl em,
Map<String,Class> namedParameterTypeRedefinitions) |
Modifier and Type | Method and Description |
---|---|
protected void |
applyAliasSpecificLockMode(String alias,
LockMode lockMode) |
protected void |
applyCacheable(boolean isCacheable) |
protected void |
applyCacheMode(CacheMode cacheMode) |
protected void |
applyCacheRegion(String regionName) |
protected void |
applyComment(String comment) |
protected void |
applyFetchSize(int fetchSize) |
protected void |
applyFirstResult(int firstResult)
Apply the given first-result value.
|
protected void |
applyFlushMode(FlushMode flushMode) |
protected void |
applyLockTimeout(int timeout) |
protected void |
applyMaxResults(int maxResults)
Apply the given max results value.
|
protected void |
applyReadOnly(boolean isReadOnly) |
protected void |
applyTimeout(int timeout) |
protected boolean |
canApplyLockModes() |
Query |
getHibernateQuery() |
LockModeType |
getLockMode()
Get the current lock mode for the query.
|
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<Parameter<?>> |
getParameters()
Get the parameter objects corresponding to the declared
parameters of the query.
|
List<X> |
getResultList()
Execute a SELECT query and return the query results
as a typed List.
|
X |
getSingleResult()
Execute a SELECT query that returns a single result.
|
protected int |
internalExecuteUpdate()
Actually execute the update; all pre-requisites have been checked.
|
TypedQuery<X> |
setLockMode(LockModeType lockModeType)
Set the lock mode type to be used for the query execution.
|
TypedQuery<X> |
setParameter(int position,
Calendar value,
TemporalType temporalType)
Bind an instance of
java.util.Calendar to a positional
parameter. |
TypedQuery<X> |
setParameter(int position,
Date value,
TemporalType temporalType)
Bind an instance of
java.util.Date to a positional parameter. |
TypedQuery<X> |
setParameter(int position,
Object value)
Bind an argument to a positional parameter.
|
TypedQuery<X> |
setParameter(Parameter<Calendar> param,
Calendar value,
TemporalType temporalType)
Bind an instance of
java.util.Calendar to a Parameter object. |
TypedQuery<X> |
setParameter(Parameter<Date> param,
Date value,
TemporalType temporalType)
Bind an instance of
java.util.Date to a Parameter object. |
<T> TypedQuery<X> |
setParameter(Parameter<T> param,
T value)
Bind the value of a
Parameter object. |
TypedQuery<X> |
setParameter(String name,
Calendar value,
TemporalType temporalType)
Bind an instance of
java.util.Calendar to a named parameter. |
TypedQuery<X> |
setParameter(String name,
Date value,
TemporalType temporalType)
Bind an instance of
java.util.Date to a named parameter. |
TypedQuery<X> |
setParameter(String name,
Object value)
Bind an argument to a named parameter.
|
<T> T |
unwrap(Class<T> tClass)
Return an object of the specified type to allow access to
the provider-specific API.
|
executeUpdate, getEntityManager, getFirstResult, getFlushMode, getHints, getMaxResults, getParameterValue, getParameterValue, getParameterValue, getSpecifiedFlushMode, getSpecifiedMaxResults, getSupportedHints, isBound, registerParameterBinding, registerParameterBinding, setFirstResult, setFlushMode, setHint, setMaxResults
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
setFirstResult, setFlushMode, setHint, setMaxResults
executeUpdate, getFirstResult, getFlushMode, getHints, getMaxResults, getParameterValue, getParameterValue, getParameterValue, isBound
public static final EntityManagerMessageLogger LOG
public QueryImpl(Query query, AbstractEntityManagerImpl em)
public QueryImpl(Query query, AbstractEntityManagerImpl em, Map<String,Class> namedParameterTypeRedefinitions)
public Query getHibernateQuery()
getHibernateQuery
in interface HibernateQuery
protected int internalExecuteUpdate()
AbstractQueryImpl
internalExecuteUpdate
in class AbstractQueryImpl<X>
protected void applyMaxResults(int maxResults)
AbstractQueryImpl
applyMaxResults
in class AbstractQueryImpl<X>
maxResults
- The specified max resultsprotected void applyFirstResult(int firstResult)
AbstractQueryImpl
applyFirstResult
in class AbstractQueryImpl<X>
firstResult
- The specified first-result value.protected void applyTimeout(int timeout)
applyTimeout
in class AbstractQueryImpl<X>
protected void applyComment(String comment)
applyComment
in class AbstractQueryImpl<X>
protected void applyFetchSize(int fetchSize)
applyFetchSize
in class AbstractQueryImpl<X>
protected void applyCacheable(boolean isCacheable)
applyCacheable
in class AbstractQueryImpl<X>
protected void applyCacheRegion(String regionName)
applyCacheRegion
in class AbstractQueryImpl<X>
protected void applyReadOnly(boolean isReadOnly)
applyReadOnly
in class AbstractQueryImpl<X>
protected void applyCacheMode(CacheMode cacheMode)
applyCacheMode
in class AbstractQueryImpl<X>
protected void applyFlushMode(FlushMode flushMode)
applyFlushMode
in class AbstractQueryImpl<X>
protected boolean canApplyLockModes()
canApplyLockModes
in class AbstractQueryImpl<X>
protected void applyAliasSpecificLockMode(String alias, LockMode lockMode)
applyAliasSpecificLockMode
in class AbstractQueryImpl<X>
public List<X> getResultList()
getResultList
in interface Query
getResultList
in interface TypedQuery<X>
public X getSingleResult()
getSingleResult
in interface Query
getSingleResult
in interface TypedQuery<X>
public <T> TypedQuery<X> setParameter(Parameter<T> param, T value)
TypedQuery
Parameter
object.setParameter
in interface Query
setParameter
in interface TypedQuery<X>
param
- parameter objectvalue
- parameter valuepublic TypedQuery<X> setParameter(Parameter<Date> param, Date value, TemporalType temporalType)
TypedQuery
java.util.Date
to a Parameter
object.setParameter
in interface Query
setParameter
in interface TypedQuery<X>
param
- parameter objectvalue
- parameter valuetemporalType
- temporal typepublic TypedQuery<X> setParameter(Parameter<Calendar> param, Calendar value, TemporalType temporalType)
TypedQuery
java.util.Calendar
to a Parameter
object.setParameter
in interface Query
setParameter
in interface TypedQuery<X>
param
- parameter objectvalue
- parameter valuetemporalType
- temporal typepublic TypedQuery<X> setParameter(String name, Object value)
setParameter
in interface Query
setParameter
in interface TypedQuery<X>
name
- parameter namevalue
- parameter valuepublic TypedQuery<X> setParameter(String name, Date value, TemporalType temporalType)
java.util.Date
to a named parameter.setParameter
in interface Query
setParameter
in interface TypedQuery<X>
name
- parameter namevalue
- parameter valuetemporalType
- temporal typepublic TypedQuery<X> setParameter(String name, Calendar value, TemporalType temporalType)
java.util.Calendar
to a named parameter.setParameter
in interface Query
setParameter
in interface TypedQuery<X>
name
- parameter namevalue
- parameter valuetemporalType
- temporal typepublic TypedQuery<X> setParameter(int position, Object value)
setParameter
in interface Query
setParameter
in interface TypedQuery<X>
position
- positionvalue
- parameter valuepublic TypedQuery<X> setParameter(int position, Date value, TemporalType temporalType)
java.util.Date
to a positional parameter.setParameter
in interface Query
setParameter
in interface TypedQuery<X>
position
- positionvalue
- parameter valuetemporalType
- temporal typepublic TypedQuery<X> setParameter(int position, Calendar value, TemporalType temporalType)
java.util.Calendar
to a positional
parameter.setParameter
in interface Query
setParameter
in interface TypedQuery<X>
position
- positionvalue
- parameter valuetemporalType
- temporal typepublic Set<Parameter<?>> getParameters()
getParameters
in interface Query
public Parameter<?> getParameter(String name)
getParameter
in interface Query
name
- parameter namepublic Parameter<?> getParameter(int position)
getParameter
in interface Query
position
- positionpublic <T> Parameter<T> getParameter(String name, Class<T> type)
getParameter
in interface Query
name
- parameter nametype
- typepublic <T> Parameter<T> getParameter(int position, Class<T> type)
getParameter
in interface Query
position
- positiontype
- typepublic <T> T unwrap(Class<T> tClass)
PersistenceException
is thrown.public TypedQuery<X> setLockMode(LockModeType lockModeType)
TypedQuery
setLockMode
in interface Query
setLockMode
in interface TypedQuery<X>
setLockMode
in class AbstractQueryImpl<X>
lockModeType
- lock modeprotected void applyLockTimeout(int timeout)
applyLockTimeout
in class AbstractQueryImpl<X>
public LockModeType getLockMode()
Query
getLockMode
in interface Query
getLockMode
in class AbstractQueryImpl<X>
Copyright © 2018 JBoss by Red Hat. All rights reserved.