|
EclipseLink 2.0.0, build 'v20091127-r5931' API Reference | |||||||||
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.
TypedQuery
,
Parameter
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()
Get the flush mode in effect for the query execution. |
|
java.util.Map<java.lang.String,java.lang.Object> |
getHints()
Get the properties and 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. |
|
Parameter<?> |
getParameter(int position)
Get the parameter object corresponding to the declared positional parameter with the given position. |
|
|
getParameter(int position,
java.lang.Class<T> type)
Get the parameter object corresponding to the declared positional parameter with the given position and type. |
|
Parameter<?> |
getParameter(java.lang.String name)
Get the parameter object corresponding to the declared parameter of the given name. |
|
|
getParameter(java.lang.String name,
java.lang.Class<T> type)
Get the parameter object corresponding to the declared parameter of the given name and type. |
|
java.util.Set<Parameter<?>> |
getParameters()
Get the parameter objects corresponding to the declared parameters of the query. |
|
java.lang.Object |
getParameterValue(int position)
Return the value bound to the positional parameter. |
|
|
getParameterValue(Parameter<T> param)
Return the value bound to the parameter. |
|
java.lang.Object |
getParameterValue(java.lang.String name)
Return the value bound to the named parameter. |
|
java.util.List |
getResultList()
Execute a SELECT query and return the query results as an untyped List. |
|
java.lang.Object |
getSingleResult()
Execute a SELECT query that returns a single untyped result. |
|
boolean |
isBound(Parameter<?> param)
Return a boolean indicating whether a value has been bound to the parameter. |
|
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(java.lang.String hintName,
java.lang.Object value)
Set a query property or 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,
java.util.Calendar value,
TemporalType temporalType)
Bind an instance of java.util.Calendar to a positional
parameter. |
|
Query |
setParameter(int position,
java.util.Date value,
TemporalType temporalType)
Bind an instance of java.util.Date to a positional parameter. |
|
Query |
setParameter(int position,
java.lang.Object value)
Bind an argument to a positional parameter. |
|
Query |
setParameter(Parameter<java.util.Calendar> param,
java.util.Calendar value,
TemporalType temporalType)
Bind an instance of java.util.Calendar to a Parameter object. |
|
Query |
setParameter(Parameter<java.util.Date> param,
java.util.Date value,
TemporalType temporalType)
Bind an instance of java.util.Date to a Parameter object. |
|
|
setParameter(Parameter<T> param,
T value)
Bind the value of a Parameter object. |
|
Query |
setParameter(java.lang.String name,
java.util.Calendar value,
TemporalType temporalType)
Bind an instance of java.util.Calendar to a named parameter. |
|
Query |
setParameter(java.lang.String name,
java.util.Date value,
TemporalType temporalType)
Bind an instance of java.util.Date to a named parameter. |
|
Query |
setParameter(java.lang.String name,
java.lang.Object value)
Bind an argument to a named parameter. |
|
|
unwrap(java.lang.Class<T> cls)
Return an object of the specified type to allow access to the provider-specific API. |
Method Detail |
---|
java.util.List getResultList()
java.lang.IllegalStateException
- if called for a Java
Persistence query language UPDATE or DELETE statement
QueryTimeoutException
- if the query execution exceeds
the query timeout value set and only the statement is
rolled back
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 back
PersistenceException
- if the query execution exceeds
the query timeout value set and the transaction
is rolled backjava.lang.Object getSingleResult()
NoResultException
- if there is no result
NonUniqueResultException
- if more than one result
java.lang.IllegalStateException
- if called for a Java
Persistence query language UPDATE or DELETE statement
QueryTimeoutException
- if the query execution exceeds
the query timeout value set and only the statement is
rolled back
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 back
PersistenceException
- if the query execution exceeds
the query timeout value set and the transaction
is rolled backint executeUpdate()
java.lang.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 set and only
the statement is rolled back
PersistenceException
- if the query execution exceeds
the query timeout value set and the transaction
is rolled backQuery setMaxResults(int maxResult)
maxResult
- maximum number of results to retrieve
java.lang.IllegalArgumentException
- if the argument is negativeint getMaxResults()
Integer.MAX_VALUE
if setMaxResults
was not
applied to the query object.
Query setFirstResult(int startPosition)
startPosition
- position of the first result,
numbered from 0
java.lang.IllegalArgumentException
- if the argument is negativeint getFirstResult()
setFirstResult
was not applied to the
query object.
Query setHint(java.lang.String hintName, java.lang.Object value)
hintName
- name of the property or hintvalue
- value for the property or hint
java.lang.IllegalArgumentException
- if the second argument is not
valid for the implementationjava.util.Map<java.lang.String,java.lang.Object> getHints()
<T> Query setParameter(Parameter<T> param, T value)
Parameter
object.
param
- parameter objectvalue
- parameter value
java.lang.IllegalArgumentException
- if the parameter
does not correspond to a parameter of the
queryQuery setParameter(Parameter<java.util.Calendar> param, java.util.Calendar value, TemporalType temporalType)
java.util.Calendar
to a Parameter
object.
param
- parameter objectvalue
- parameter valuetemporalType
- temporal type
java.lang.IllegalArgumentException
- if the parameter does not
correspond to a parameter of the queryQuery setParameter(Parameter<java.util.Date> param, java.util.Date value, TemporalType temporalType)
java.util.Date
to a Parameter
object.
param
- parameter objectvalue
- parameter valuetemporalType
- temporal type
java.lang.IllegalArgumentException
- if the parameter does not
correspond to a parameter of the queryQuery setParameter(java.lang.String name, java.lang.Object value)
name
- parameter namevalue
- parameter value
java.lang.IllegalArgumentException
- if the parameter name does
not correspond to a parameter of the query or if
the argument is of incorrect typeQuery setParameter(java.lang.String name, java.util.Calendar value, TemporalType temporalType)
java.util.Calendar
to a named parameter.
name
- parameter namevalue
- parameter valuetemporalType
- temporal type
java.lang.IllegalArgumentException
- if the parameter name does
not correspond to a parameter of the query or if
the value argument is of incorrect typeQuery setParameter(java.lang.String name, java.util.Date value, TemporalType temporalType)
java.util.Date
to a named parameter.
name
- parameter namevalue
- parameter valuetemporalType
- temporal type
java.lang.IllegalArgumentException
- if the parameter name does
not correspond to a parameter of the query or if
the value argument is of incorrect typeQuery setParameter(int position, java.lang.Object value)
position
- positionvalue
- parameter value
java.lang.IllegalArgumentException
- if position does not
correspond to a positional parameter of the
query or if the argument is of incorrect typeQuery setParameter(int position, java.util.Calendar value, TemporalType temporalType)
java.util.Calendar
to a positional
parameter.
position
- positionvalue
- parameter valuetemporalType
- temporal type
java.lang.IllegalArgumentException
- if position does not
correspond to a positional parameter of the query or
if the value argument is of incorrect typeQuery setParameter(int position, java.util.Date value, TemporalType temporalType)
java.util.Date
to a positional parameter.
position
- positionvalue
- parameter valuetemporalType
- temporal type
java.lang.IllegalArgumentException
- if position does not
correspond to a positional parameter of the query or
if the value argument is of incorrect typejava.util.Set<Parameter<?>> getParameters()
java.lang.IllegalStateException
- if invoked on a native
query when the implementation does not support
this useParameter<?> getParameter(java.lang.String name)
name
- parameter name
java.lang.IllegalArgumentException
- if the parameter of the
specified name does not exist
java.lang.IllegalStateException
- if invoked on a native
query when the implementation does not support
this use<T> Parameter<T> getParameter(java.lang.String name, java.lang.Class<T> type)
name
- parameter nametype
- type
java.lang.IllegalArgumentException
- if the parameter of the
specified name does not exist or is not assignable
to the type
java.lang.IllegalStateException
- if invoked on a native
query or Java Persistence query language query when
the implementation does not support this useParameter<?> getParameter(int position)
position
- position
java.lang.IllegalArgumentException
- if the parameter with the
specified position does not exist
java.lang.IllegalStateException
- if invoked on a native
query when the implementation does not support
this use<T> Parameter<T> getParameter(int position, java.lang.Class<T> type)
position
- positiontype
- type
java.lang.IllegalArgumentException
- if the parameter with the
specified position does not exist or is not assignable
to the type
java.lang.IllegalStateException
- if invoked on a native
query or Java Persistence query language query when
the implementation does not support this useboolean isBound(Parameter<?> param)
param
- parameter object
<T> T getParameterValue(Parameter<T> param)
param
- parameter object
java.lang.IllegalArgumentException
- if the parameter is not
a parameter of the query
java.lang.IllegalStateException
- if the parameter has not been
been boundjava.lang.Object getParameterValue(java.lang.String name)
name
- parameter name
java.lang.IllegalStateException
- if the parameter has not been
been bound
java.lang.IllegalArgumentException
- if the parameter of the
specified name does not existjava.lang.Object getParameterValue(int position)
position
- position
java.lang.IllegalStateException
- if the parameter has not been
been bound
java.lang.IllegalArgumentException
- if the parameter with the
specified position does not existQuery setFlushMode(FlushModeType flushMode)
flushMode
- flush mode
FlushModeType getFlushMode()
Query setLockMode(LockModeType lockMode)
lockMode
- lock mode
java.lang.IllegalStateException
- if the query is found not to be
a Java Persistence query language SELECT query
or a Criteria API queryLockModeType getLockMode()
java.lang.IllegalStateException
- if the query is found not to be
a Java Persistence query language SELECT query or
a Criteria API query<T> T unwrap(java.lang.Class<T> cls)
PersistenceException
is thrown.
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
|
EclipseLink 2.0.0, build 'v20091127-r5931' API Reference | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |