javax.persistence
Interface Query

All Known Subinterfaces:
TypedQuery<X>
All Known Implementing Classes:
QueryImpl, QueryImpl

public interface Query

The main application interface to the persistence context.


Method Summary
 int executeUpdate()
          An update or delete query.
 int getFirstResult()
          The first to retrieve.
 FlushModeType getFlushMode()
          Gets the flush type.
 java.util.Map<java.lang.String,java.lang.Object> getHints()
          Returns the implementation-specific hints
 LockModeType getLockMode()
          Gets the lock type.
 int getMaxResults()
          The maximum number of results to retrieve.
 Parameter<?> getParameter(int pos)
           
<T> Parameter<T>
getParameter(int position, java.lang.Class<T> type)
           
 Parameter<?> getParameter(java.lang.String name)
           
<T> Parameter<T>
getParameter(java.lang.String name, java.lang.Class<T> type)
           
 java.util.Set<Parameter<?>> getParameters()
           
 java.lang.Object getParameterValue(int position)
           
<T> T
getParameterValue(Parameter<T> param)
           
 java.lang.Object getParameterValue(java.lang.String name)
           
 java.util.List getResultList()
          Executes a SELECT and return the results as a list.
 java.lang.Object getSingleResult()
          Returns the single result of a query.
 boolean isBound(Parameter<?> param)
           
 Query setFirstResult(int startPosition)
          Sets the first result.
 Query setFlushMode(FlushModeType flushMode)
          Sets the flush type.
 Query setHint(java.lang.String hintName, java.lang.Object value)
          An implementation-specific hint.
 Query setLockMode(LockModeType lockMode)
          Sets the lock type.
 Query setMaxResults(int maxResult)
          The maximum number of results to retrieve.
 Query setParameter(int pos, java.util.Calendar date, TemporalType type)
          Sets a calendar parameter.
 Query setParameter(int pos, java.util.Date date, TemporalType type)
          Sets a date parameter.
 Query setParameter(int pos, java.lang.Object value)
          Binds a position parameter.
 Query setParameter(Parameter<java.util.Calendar> param, java.util.Calendar date, TemporalType type)
          Sets a calendar parameter.
 Query setParameter(Parameter<java.util.Date> param, java.util.Date value, TemporalType temporalType)
          Sets a date parameter.
<T> Query
setParameter(Parameter<T> param, T value)
          Binds a named parameter.
 Query setParameter(java.lang.String name, java.util.Calendar date, TemporalType type)
          Sets a calendar parameter.
 Query setParameter(java.lang.String name, java.util.Date date, TemporalType type)
          Sets a date parameter.
 Query setParameter(java.lang.String name, java.lang.Object value)
          Binds a position parameter.
<T> T
unwrap(java.lang.Class<T> cl)
           
 

Method Detail

getResultList

java.util.List getResultList()
Executes a SELECT and return the results as a list.


getSingleResult

java.lang.Object getSingleResult()
Returns the single result of a query.


executeUpdate

int executeUpdate()
An update or delete query.


setMaxResults

Query setMaxResults(int maxResult)
The maximum number of results to retrieve.


getMaxResults

int getMaxResults()
The maximum number of results to retrieve.


setFirstResult

Query setFirstResult(int startPosition)
Sets the first result.


getFirstResult

int getFirstResult()
The first to retrieve.


setHint

Query setHint(java.lang.String hintName,
              java.lang.Object value)
An implementation-specific hint.


getHints

java.util.Map<java.lang.String,java.lang.Object> getHints()
Returns the implementation-specific hints


setParameter

<T> Query setParameter(Parameter<T> param,
                       T value)
Binds a named parameter.


setParameter

Query setParameter(Parameter<java.util.Calendar> param,
                   java.util.Calendar date,
                   TemporalType type)
Sets a calendar parameter.


setParameter

Query setParameter(Parameter<java.util.Date> param,
                   java.util.Date value,
                   TemporalType temporalType)
Sets a date parameter.


setParameter

Query setParameter(java.lang.String name,
                   java.lang.Object value)
Binds a position parameter.


setParameter

Query setParameter(int pos,
                   java.lang.Object value)
Binds a position parameter.


setParameter

Query setParameter(java.lang.String name,
                   java.util.Calendar date,
                   TemporalType type)
Sets a calendar parameter.


setParameter

Query setParameter(java.lang.String name,
                   java.util.Date date,
                   TemporalType type)
Sets a date parameter.


setParameter

Query setParameter(int pos,
                   java.util.Date date,
                   TemporalType type)
Sets a date parameter.


setParameter

Query setParameter(int pos,
                   java.util.Calendar date,
                   TemporalType type)
Sets a calendar parameter.


getParameters

java.util.Set<Parameter<?>> getParameters()

getParameter

Parameter<?> getParameter(java.lang.String name)

getParameter

<T> Parameter<T> getParameter(java.lang.String name,
                              java.lang.Class<T> type)

getParameter

Parameter<?> getParameter(int pos)

getParameter

<T> Parameter<T> getParameter(int position,
                              java.lang.Class<T> type)

isBound

boolean isBound(Parameter<?> param)

getParameterValue

<T> T getParameterValue(Parameter<T> param)

getParameterValue

java.lang.Object getParameterValue(java.lang.String name)

getParameterValue

java.lang.Object getParameterValue(int position)

setFlushMode

Query setFlushMode(FlushModeType flushMode)
Sets the flush type.


getFlushMode

FlushModeType getFlushMode()
Gets the flush type.

Since:
JPA 2.0

setLockMode

Query setLockMode(LockModeType lockMode)
Sets the lock type.

Since:
JPA 2.0

getLockMode

LockModeType getLockMode()
Gets the lock type.

Since:
JPA 2.0

unwrap

<T> T unwrap(java.lang.Class<T> cl)