| Modifier and Type | Method and Description |
|---|---|
java.util.List<X> |
getResultList()
Execute a SELECT query and return the query results
as a typed List.
|
default java.util.stream.Stream<X> |
getResultStream()
Execute a SELECT query and return the query results
as a typed
java.util.stream.Stream. |
X |
getSingleResult()
Execute a SELECT query that returns a single result.
|
TypedQuery<X> |
setFirstResult(int startPosition)
Set the position of the first result to retrieve.
|
TypedQuery<X> |
setFlushMode(FlushModeType flushMode)
Set the flush mode type to be used for the query execution.
|
TypedQuery<X> |
setHint(java.lang.String hintName,
java.lang.Object value)
Set a query property or hint.
|
TypedQuery<X> |
setLockMode(LockModeType lockMode)
Set the lock mode type to be used for the query execution.
|
TypedQuery<X> |
setMaxResults(int maxResult)
Set the maximum number of results to retrieve.
|
TypedQuery<X> |
setParameter(int position,
java.util.Calendar value,
TemporalType temporalType)
Bind an instance of
java.util.Calendar to a positional
parameter. |
TypedQuery<X> |
setParameter(int position,
java.util.Date value,
TemporalType temporalType)
Bind an instance of
java.util.Date to a positional parameter. |
TypedQuery<X> |
setParameter(int position,
java.lang.Object value)
Bind an argument value to a positional parameter.
|
TypedQuery<X> |
setParameter(Parameter<java.util.Calendar> param,
java.util.Calendar value,
TemporalType temporalType)
Bind an instance of
java.util.Calendar to a Parameter object. |
TypedQuery<X> |
setParameter(Parameter<java.util.Date> param,
java.util.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(java.lang.String name,
java.util.Calendar value,
TemporalType temporalType)
Bind an instance of
java.util.Calendar to a named parameter. |
TypedQuery<X> |
setParameter(java.lang.String name,
java.util.Date value,
TemporalType temporalType)
Bind an instance of
java.util.Date to a named parameter. |
TypedQuery<X> |
setParameter(java.lang.String name,
java.lang.Object value)
Bind an argument value to a named parameter.
|
executeUpdate, getFirstResult, getFlushMode, getHints, getLockMode, getMaxResults, getParameter, getParameter, getParameter, getParameter, getParameters, getParameterValue, getParameterValue, getParameterValue, isBound, unwrapjava.util.List<X> getResultList()
getResultList in interface Queryjava.lang.IllegalStateException - if called for a Java
Persistence query language UPDATE or DELETE statementQueryTimeoutException - if the query execution exceeds
the query timeout value set and only the statement is
rolled backTransactionRequiredException - if a lock mode other than
NONE has been set and there is no transaction
or the persistence context has not been joined to the
transactionPessimisticLockException - if pessimistic locking
fails and the transaction is rolled backLockTimeoutException - if pessimistic locking
fails and only the statement is rolled backPersistenceException - if the query execution exceeds
the query timeout value set and the transaction
is rolled backdefault java.util.stream.Stream<X> getResultStream()
java.util.stream.Stream.
By default this method delegates to getResultList().stream(),
however persistence provider may choose to override this method
to provide additional capabilities.getResultStream in interface Queryjava.lang.IllegalStateException - if called for a Java
Persistence query language UPDATE or DELETE statementQueryTimeoutException - if the query execution exceeds
the query timeout value set and only the statement is
rolled backTransactionRequiredException - if a lock mode other than
NONE has been set and there is no transaction
or the persistence context has not been joined to the transactionPessimisticLockException - if pessimistic locking
fails and the transaction is rolled backLockTimeoutException - if pessimistic locking
fails and only the statement is rolled backPersistenceException - if the query execution exceeds
the query timeout value set and the transaction
is rolled backStream,
getResultList()X getSingleResult()
getSingleResult in interface QueryNoResultException - if there is no resultNonUniqueResultException - if more than one resultjava.lang.IllegalStateException - if called for a Java
Persistence query language UPDATE or DELETE statementQueryTimeoutException - if the query execution exceeds
the query timeout value set and only the statement is
rolled backTransactionRequiredException - if a lock mode other than
NONE has been set and there is no transaction
or the persistence context has not been joined to the
transactionPessimisticLockException - if pessimistic locking
fails and the transaction is rolled backLockTimeoutException - if pessimistic locking
fails and only the statement is rolled backPersistenceException - if the query execution exceeds
the query timeout value set and the transaction
is rolled backTypedQuery<X> setMaxResults(int maxResult)
setMaxResults in interface QuerymaxResult - maximum number of results to retrievejava.lang.IllegalArgumentException - if the argument is negativeTypedQuery<X> setFirstResult(int startPosition)
setFirstResult in interface QuerystartPosition - position of the first result,
numbered from 0java.lang.IllegalArgumentException - if the argument is negativeTypedQuery<X> setHint(java.lang.String hintName, java.lang.Object value)
<T> TypedQuery<X> setParameter(Parameter<T> param, T value)
Parameter object.setParameter in interface Queryparam - parameter objectvalue - parameter valuejava.lang.IllegalArgumentException - if the parameter
does not correspond to a parameter of the
queryTypedQuery<X> setParameter(Parameter<java.util.Calendar> param, java.util.Calendar value, TemporalType temporalType)
java.util.Calendar to a Parameter object.setParameter in interface Queryparam - parameter objectvalue - parameter valuetemporalType - temporal typejava.lang.IllegalArgumentException - if the parameter does not
correspond to a parameter of the queryTypedQuery<X> setParameter(Parameter<java.util.Date> param, java.util.Date value, TemporalType temporalType)
java.util.Date to a Parameter object.setParameter in interface Queryparam - parameter objectvalue - parameter valuetemporalType - temporal typejava.lang.IllegalArgumentException - if the parameter does not
correspond to a parameter of the queryTypedQuery<X> setParameter(java.lang.String name, java.lang.Object value)
setParameter in interface Queryname - parameter namevalue - parameter valuejava.lang.IllegalArgumentException - if the parameter name does
not correspond to a parameter of the query or if
the argument is of incorrect typeTypedQuery<X> setParameter(java.lang.String name, java.util.Calendar value, TemporalType temporalType)
java.util.Calendar to a named parameter.setParameter in interface Queryname - parameter namevalue - parameter valuetemporalType - temporal typejava.lang.IllegalArgumentException - if the parameter name does
not correspond to a parameter of the query or if
the value argument is of incorrect typeTypedQuery<X> setParameter(java.lang.String name, java.util.Date value, TemporalType temporalType)
java.util.Date to a named parameter.setParameter in interface Queryname - parameter namevalue - parameter valuetemporalType - temporal typejava.lang.IllegalArgumentException - if the parameter name does
not correspond to a parameter of the query or if
the value argument is of incorrect typeTypedQuery<X> setParameter(int position, java.lang.Object value)
setParameter in interface Queryposition - positionvalue - parameter valuejava.lang.IllegalArgumentException - if position does not
correspond to a positional parameter of the
query or if the argument is of incorrect typeTypedQuery<X> setParameter(int position, java.util.Calendar value, TemporalType temporalType)
java.util.Calendar to a positional
parameter.setParameter in interface Queryposition - positionvalue - parameter valuetemporalType - temporal typejava.lang.IllegalArgumentException - if position does not
correspond to a positional parameter of the query
or if the value argument is of incorrect typeTypedQuery<X> setParameter(int position, java.util.Date value, TemporalType temporalType)
java.util.Date to a positional parameter.setParameter in interface Queryposition - positionvalue - parameter valuetemporalType - temporal typejava.lang.IllegalArgumentException - if position does not
correspond to a positional parameter of the query
or if the value argument is of incorrect typeTypedQuery<X> setFlushMode(FlushModeType flushMode)
setFlushMode in interface QueryflushMode - flush modeTypedQuery<X> setLockMode(LockModeType lockMode)
setLockMode in interface QuerylockMode - lock modejava.lang.IllegalStateException - if the query is found not to
be a Jakarta Persistence query language SELECT query
or a CriteriaQuery query