X
- The result type of this querypublic abstract class ErraiTypedQuery<X> extends Object implements javax.persistence.TypedQuery<X>, EntityJsonMatcher
Modifier | Constructor and Description |
---|---|
protected |
ErraiTypedQuery(ErraiEntityManager entityManager,
Class<X> actualResultType,
com.google.common.collect.ImmutableBiMap<String,javax.persistence.Parameter<?>> parameters) |
Modifier and Type | Method and Description |
---|---|
int |
executeUpdate()
Execute an update or delete statement.
|
protected abstract Comparator<X> |
getComparator()
Returns a comparator that can be used for sorting a list of result objects
based on the ORDER BY clause and the current parameter values of this
query.
|
int |
getFirstResult()
The position of the first result the query object was set to
retrieve.
|
javax.persistence.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.
|
javax.persistence.LockModeType |
getLockMode()
Get the current lock mode for the query.
|
int |
getMaxResults()
The maximum number of results the query object was set to
retrieve.
|
javax.persistence.Parameter<?> |
getParameter(int position)
Get the parameter object corresponding to the declared
positional parameter with the given position.
|
<T> javax.persistence.Parameter<T> |
getParameter(int position,
Class<T> type)
Get the parameter object corresponding to the declared
positional parameter with the given position and type.
|
javax.persistence.Parameter<?> |
getParameter(String name)
Get the parameter object corresponding to the declared
parameter of the given name.
|
<T> javax.persistence.Parameter<T> |
getParameter(String name,
Class<T> type)
Get the parameter object corresponding to the declared
parameter of the given name and type.
|
Set<javax.persistence.Parameter<?>> |
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(javax.persistence.Parameter<T> param)
Return the value bound to the parameter.
|
Object |
getParameterValue(String name)
Return the value bound to the named parameter.
|
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.
|
boolean |
isBound(javax.persistence.Parameter<?> param)
Return a boolean indicating whether a value has been bound
to the parameter.
|
javax.persistence.TypedQuery<X> |
setFirstResult(int startPosition)
Set the position of the first result to retrieve.
|
javax.persistence.TypedQuery<X> |
setFlushMode(javax.persistence.FlushModeType flushMode)
Set the flush mode type to be used for the query execution.
|
javax.persistence.TypedQuery<X> |
setHint(String hintName,
Object value)
Set a query property or hint.
|
javax.persistence.TypedQuery<X> |
setLockMode(javax.persistence.LockModeType lockMode)
Set the lock mode type to be used for the query execution.
|
javax.persistence.TypedQuery<X> |
setMaxResults(int maxResult)
Set the maximum number of results to retrieve.
|
javax.persistence.TypedQuery<X> |
setParameter(int position,
Date value,
javax.persistence.TemporalType temporalType)
Bind an instance of
java.util.Date to a positional parameter. |
javax.persistence.TypedQuery<X> |
setParameter(int position,
Object value)
Bind an argument to a positional parameter.
|
javax.persistence.TypedQuery<X> |
setParameter(javax.persistence.Parameter<Date> param,
Date value,
javax.persistence.TemporalType temporalType)
Bind an instance of
java.util.Date to a Parameter object. |
<T> javax.persistence.TypedQuery<X> |
setParameter(javax.persistence.Parameter<T> param,
T value)
Bind the value of a
Parameter object. |
javax.persistence.TypedQuery<X> |
setParameter(String name,
Date value,
javax.persistence.TemporalType temporalType)
Bind an instance of
java.util.Date to a named parameter. |
javax.persistence.TypedQuery<X> |
setParameter(String name,
Object value)
Bind an argument to a named parameter.
|
<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, wait
matches
protected ErraiTypedQuery(ErraiEntityManager entityManager, Class<X> actualResultType, com.google.common.collect.ImmutableBiMap<String,javax.persistence.Parameter<?>> parameters)
entityManager
- The EntityManager within whose scope this query will be executed.actualResultType
- The result type of this query. Must be an entity type known to
entityManager
.parameters
- The parameters of this query. The iteration order of the
parameters in the map must be their numeric order in the query
(ImmutableMap has a stable iteration order).protected abstract Comparator<X> getComparator()
public int executeUpdate()
javax.persistence.Query
executeUpdate
in interface javax.persistence.Query
public int getMaxResults()
javax.persistence.Query
Integer.MAX_VALUE
if setMaxResults
was not
applied to the query object.getMaxResults
in interface javax.persistence.Query
public int getFirstResult()
javax.persistence.Query
setFirstResult
was not applied to the
query object.getFirstResult
in interface javax.persistence.Query
public Map<String,Object> getHints()
javax.persistence.Query
getHints
in interface javax.persistence.Query
public Set<javax.persistence.Parameter<?>> getParameters()
javax.persistence.Query
getParameters
in interface javax.persistence.Query
public javax.persistence.Parameter<?> getParameter(String name)
javax.persistence.Query
getParameter
in interface javax.persistence.Query
name
- parameter namepublic <T> javax.persistence.Parameter<T> getParameter(String name, Class<T> type)
javax.persistence.Query
getParameter
in interface javax.persistence.Query
name
- parameter nametype
- typepublic javax.persistence.Parameter<?> getParameter(int position)
javax.persistence.Query
getParameter
in interface javax.persistence.Query
position
- positionpublic <T> javax.persistence.Parameter<T> getParameter(int position, Class<T> type)
javax.persistence.Query
getParameter
in interface javax.persistence.Query
position
- positiontype
- typepublic boolean isBound(javax.persistence.Parameter<?> param)
javax.persistence.Query
isBound
in interface javax.persistence.Query
param
- parameter objectpublic <T> T getParameterValue(javax.persistence.Parameter<T> param)
javax.persistence.Query
getParameterValue
in interface javax.persistence.Query
param
- parameter objectpublic Object getParameterValue(String name)
javax.persistence.Query
getParameterValue
in interface javax.persistence.Query
name
- parameter namepublic Object getParameterValue(int position)
javax.persistence.Query
getParameterValue
in interface javax.persistence.Query
position
- positionpublic javax.persistence.FlushModeType getFlushMode()
javax.persistence.Query
getFlushMode
in interface javax.persistence.Query
public javax.persistence.LockModeType getLockMode()
javax.persistence.Query
getLockMode
in interface javax.persistence.Query
public <T> T unwrap(Class<T> cls)
javax.persistence.Query
PersistenceException
is thrown.unwrap
in interface javax.persistence.Query
cls
- the class of the object to be returned. This is
normally either the underlying query
implementation class or an interface that it
implements.public List<X> getResultList()
javax.persistence.TypedQuery
getResultList
in interface javax.persistence.Query
getResultList
in interface javax.persistence.TypedQuery<X>
public X getSingleResult()
javax.persistence.TypedQuery
getSingleResult
in interface javax.persistence.Query
getSingleResult
in interface javax.persistence.TypedQuery<X>
public javax.persistence.TypedQuery<X> setMaxResults(int maxResult)
javax.persistence.TypedQuery
setMaxResults
in interface javax.persistence.Query
setMaxResults
in interface javax.persistence.TypedQuery<X>
maxResult
- maximum number of results to retrievepublic javax.persistence.TypedQuery<X> setFirstResult(int startPosition)
javax.persistence.TypedQuery
setFirstResult
in interface javax.persistence.Query
setFirstResult
in interface javax.persistence.TypedQuery<X>
startPosition
- position of the first result,
numbered from 0public javax.persistence.TypedQuery<X> setHint(String hintName, Object value)
javax.persistence.TypedQuery
setHint
in interface javax.persistence.Query
setHint
in interface javax.persistence.TypedQuery<X>
hintName
- name of property or hintvalue
- value for the property or hintpublic <T> javax.persistence.TypedQuery<X> setParameter(javax.persistence.Parameter<T> param, T value)
javax.persistence.TypedQuery
Parameter
object.setParameter
in interface javax.persistence.Query
setParameter
in interface javax.persistence.TypedQuery<X>
param
- parameter objectvalue
- parameter valuepublic javax.persistence.TypedQuery<X> setParameter(javax.persistence.Parameter<Date> param, Date value, javax.persistence.TemporalType temporalType)
javax.persistence.TypedQuery
java.util.Date
to a Parameter
object.setParameter
in interface javax.persistence.Query
setParameter
in interface javax.persistence.TypedQuery<X>
param
- parameter objectvalue
- parameter valuetemporalType
- temporal typepublic javax.persistence.TypedQuery<X> setParameter(String name, Object value)
javax.persistence.TypedQuery
setParameter
in interface javax.persistence.Query
setParameter
in interface javax.persistence.TypedQuery<X>
name
- parameter namevalue
- parameter valuepublic javax.persistence.TypedQuery<X> setParameter(String name, Date value, javax.persistence.TemporalType temporalType)
javax.persistence.TypedQuery
java.util.Date
to a named parameter.setParameter
in interface javax.persistence.Query
setParameter
in interface javax.persistence.TypedQuery<X>
name
- parameter namevalue
- parameter valuetemporalType
- temporal typepublic javax.persistence.TypedQuery<X> setParameter(int position, Object value)
javax.persistence.TypedQuery
setParameter
in interface javax.persistence.Query
setParameter
in interface javax.persistence.TypedQuery<X>
position
- positionvalue
- parameter valuepublic javax.persistence.TypedQuery<X> setParameter(int position, Date value, javax.persistence.TemporalType temporalType)
javax.persistence.TypedQuery
java.util.Date
to a positional parameter.setParameter
in interface javax.persistence.Query
setParameter
in interface javax.persistence.TypedQuery<X>
position
- positionvalue
- parameter valuetemporalType
- temporal typepublic javax.persistence.TypedQuery<X> setFlushMode(javax.persistence.FlushModeType flushMode)
javax.persistence.TypedQuery
setFlushMode
in interface javax.persistence.Query
setFlushMode
in interface javax.persistence.TypedQuery<X>
flushMode
- flush modepublic javax.persistence.TypedQuery<X> setLockMode(javax.persistence.LockModeType lockMode)
javax.persistence.TypedQuery
setLockMode
in interface javax.persistence.Query
setLockMode
in interface javax.persistence.TypedQuery<X>
lockMode
- lock modeCopyright © 2013-2015 JBoss, a division of Red Hat. All Rights Reserved.