| javax.persistence.Query
Query | public interface Query (Code) | | Interface used to control query execution.
since: Java Persistence 1.0 |
Method Summary | |
public int | executeUpdate() Execute an update or delete statement. | public List | getResultList() Execute a SELECT query and return the query results
as a List. | public Object | getSingleResult() Execute a SELECT query that returns a single result. | public Query | setFirstResult(int startPosition) Set the position of the first result to retrieve. | public Query | setFlushMode(FlushModeType flushMode) Set the flush mode type to be used for the query execution. | public Query | setHint(String hintName, Object value) Set an implementation-specific hint. | public Query | setMaxResults(int maxResult) Set the maximum number of results to retrieve. | public Query | setParameter(String name, Object value) Bind an argument to a named parameter. | public Query | setParameter(String name, Date value, TemporalType temporalType) Bind an instance of java.util.Date to a named parameter. | public Query | setParameter(String name, Calendar value, TemporalType temporalType) Bind an instance of java.util.Calendar to a named parameter. | public Query | setParameter(int position, Object value) Bind an argument to a positional parameter. | public Query | setParameter(int position, Date value, TemporalType temporalType) Bind an instance of java.util.Date to a positional parameter. | public Query | setParameter(int position, Calendar value, TemporalType temporalType) Bind an instance of java.util.Calendar to a positional parameter. |
executeUpdate | public int executeUpdate()(Code) | | Execute an update or delete statement.
the number of entities updated or deleted throws: IllegalStateException - if called for a Java Persistence query language SELECT statement throws: TransactionRequiredException - if there isno transaction |
getResultList | public List getResultList()(Code) | | Execute a SELECT query and return the query results
as a List.
a list of the results throws: IllegalStateException - if called for a Java Persistence query language UPDATE or DELETE statement |
setFirstResult | public Query setFirstResult(int startPosition)(Code) | | Set the position of the first result to retrieve.
Parameters: startPosition - the start position of the first result, numbered from 0 the same query instance throws: IllegalArgumentException - if argument is negative |
setFlushMode | public Query setFlushMode(FlushModeType flushMode)(Code) | | Set the flush mode type to be used for the query execution.
The flush mode type applies to the query regardless of the
flush mode type in use for the entity manager.
Parameters: flushMode - |
setHint | public Query setHint(String hintName, Object value)(Code) | | Set an implementation-specific hint.
If the hint name is not recognized, it is silently ignored.
Parameters: hintName - Parameters: value - the same query instance throws: IllegalArgumentException - if the second argument is notvalid for the implementation |
setMaxResults | public Query setMaxResults(int maxResult)(Code) | | Set the maximum number of results to retrieve.
Parameters: maxResult - the same query instance throws: IllegalArgumentException - if argument is negative |
setParameter | public Query setParameter(String name, Object value)(Code) | | Bind an argument to a named parameter.
Parameters: name - the parameter name Parameters: value - the same query instance throws: IllegalArgumentException - if parameter name does notcorrespond to parameter in query stringor argument is of incorrect type |
setParameter | public Query setParameter(String name, Date value, TemporalType temporalType)(Code) | | Bind an instance of java.util.Date to a named parameter.
Parameters: name - Parameters: value - Parameters: temporalType - the same query instance throws: IllegalArgumentException - if parameter name does notcorrespond to parameter in query string |
setParameter | public Query setParameter(String name, Calendar value, TemporalType temporalType)(Code) | | Bind an instance of java.util.Calendar to a named parameter.
Parameters: name - Parameters: value - Parameters: temporalType - the same query instance throws: IllegalArgumentException - if parameter name does notcorrespond to parameter in query string |
setParameter | public Query setParameter(int position, Object value)(Code) | | Bind an argument to a positional parameter.
Parameters: position - Parameters: value - the same query instance throws: IllegalArgumentException - if position does notcorrespond to positional parameter of queryor argument is of incorrect type |
setParameter | public Query setParameter(int position, Date value, TemporalType temporalType)(Code) | | Bind an instance of java.util.Date to a positional parameter.
Parameters: position - Parameters: value - Parameters: temporalType - the same query instance throws: IllegalArgumentException - if position does notcorrespond to positional parameter of query |
setParameter | public Query setParameter(int position, Calendar value, TemporalType temporalType)(Code) | | Bind an instance of java.util.Calendar to a positional parameter.
Parameters: position - Parameters: value - Parameters: temporalType - the same query instance throws: IllegalArgumentException - if position does notcorrespond to positional parameter of query |
|
|