|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface Query
Interface used to control query execution.
| Method Summary | ||
|---|---|---|
int |
executeUpdate()
Execute an update or delete statement. |
|
int |
getFirstResult()
The position of the first result the query object was set to retrieve. |
|
FlushModeType |
getFlushMode()
The flush mode in effect for the query execution. |
|
Map<String,Object> |
getHints()
Get the hints and associated values that are in effect for the query instance. |
|
LockModeType |
getLockMode()
Get the current lock mode for the query. |
|
int |
getMaxResults()
The maximum number of results the query object was set to retrieve. |
|
Map<String,Object> |
getNamedParameters()
Get the parameters names and associated values of the parameters that are bound for the query instance. |
|
List |
getPositionalParameters()
Get the values of the positional parameters that are bound for the query instance. |
|
List |
getResultList()
Execute a SELECT query and return the query results as a List. |
|
Object |
getSingleResult()
Execute a SELECT query that returns a single result. |
|
Set<String> |
getSupportedHints()
Get the names of the hints that are supported for query objects. |
|
Query |
setFirstResult(int startPosition)
Set the position of the first result to retrieve. |
|
Query |
setFlushMode(FlushModeType flushMode)
Set the flush mode type to be used for the query execution. |
|
Query |
setHint(String hintName,
Object value)
Set a query hint. |
|
Query |
setLockMode(LockModeType lockMode)
Set the lock mode type to be used for the query execution. |
|
Query |
setMaxResults(int maxResult)
Set the maximum number of results to retrieve. |
|
Query |
setParameter(int position,
Calendar value,
TemporalType temporalType)
Bind an instance of java.util.Calendar to a positional parameter. |
|
Query |
setParameter(int position,
Date value,
TemporalType temporalType)
Bind an instance of java.util.Date to a positional parameter. |
|
Query |
setParameter(int position,
Object value)
Bind an argument to a positional parameter. |
|
Query |
setParameter(String name,
Calendar value,
TemporalType temporalType)
Bind an instance of java.util.Calendar to a named parameter. |
|
Query |
setParameter(String name,
Date value,
TemporalType temporalType)
Bind an instance of java.util.Date to a named parameter. |
|
Query |
setParameter(String name,
Object value)
Bind an argument to a named parameter. |
|
|
unwrap(Class<T> cls)
Return an object of the specified type to allow access to the provider-specific API. |
|
| Method Detail |
|---|
List getResultList()
IllegalStateException - if called for a Java
Persistence query language UPDATE or DELETE statement
QueryTimeoutException - if the query execution exceeds
the query timeout value set
TransactionRequiredException - if a lock mode has
been set and there is no transaction
PessimisticLockException - if pessimistic locking
fails and the transaction is rolled back
LockTimeoutException - if pessimistic locking
fails and only the statement is rolled backObject getSingleResult()
NoResultException - if there is no result
NonUniqueResultException - if more than one result
IllegalStateException - if called for a Java
Persistence query language UPDATE or DELETE statement
QueryTimeoutException - if the query execution exceeds *the query timeout value set
TransactionRequiredException - if a lock mode has
been set and there is no transaction
PessimisticLockException - if pessimistic locking
fails and the transaction is rolled back
LockTimeoutException - if pessimistic locking
fails and only the statement is rolled backint executeUpdate()
IllegalStateException - if called for a Java
Persistence query language SELECT statement or for
a criteria query
TransactionRequiredException - if there is
no transaction
QueryTimeoutException - if the statement execution
exceeds the query timeout value setQuery setMaxResults(int maxResult)
maxResult -
IllegalArgumentException - if argument is negativeint getMaxResults()
Query setFirstResult(int startPosition)
startPosition - position of the first result, numbered from 0
IllegalArgumentException - if argument is negativeint getFirstResult()
Query setHint(String hintName,
Object value)
value -
IllegalArgumentException - if the second argument is not
valid for the implementationMap<String,Object> getHints()
Set<String> getSupportedHints()
Query setParameter(String name,
Object value)
name - the parameter namevalue -
IllegalArgumentException - if parameter name does not
correspond to a parameter of the query or if
the argument is of incorrect type
Query setParameter(String name,
Date value,
TemporalType temporalType)
name - value - temporalType -
IllegalArgumentException - if parameter name does not
correspond to a parameter of the query
Query setParameter(String name,
Calendar value,
TemporalType temporalType)
name - value - temporalType -
IllegalArgumentException - if parameter name does not
correspond to a parameter of the query
Query setParameter(int position,
Object value)
position - value -
IllegalArgumentException - if position does not
correspond to a positional parameter of
the query or if the argument is of incorrect
type
Query setParameter(int position,
Date value,
TemporalType temporalType)
position - value - temporalType -
IllegalArgumentException - if position does not
correspond to a positional parameter of the
query
Query setParameter(int position,
Calendar value,
TemporalType temporalType)
position - value - temporalType -
IllegalArgumentException - if position does not
correspond to a positional parameter of the *queryMap<String,Object> getNamedParameters()
List getPositionalParameters()
Query setFlushMode(FlushModeType flushMode)
flushMode - FlushModeType getFlushMode()
Query setLockMode(LockModeType lockMode)
lockMode -
IllegalStateException - if the query is found not to be *a Java Persistence query language SELECT query
or a Criteria API queryLockModeType getLockMode()
IllegalStateException - if the query is found not to be *a Java Persistence query language SELECT query
or a Criteria API query<T> T unwrap(Class<T> cls)
cls - the class of the object to be returned. This is
normally either the underlying Query implementation class
or an interface that it implements.
PersistenceException - if the provider does not support
the call.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||