com.caucho.amber.ejb3
Class QueryImpl

java.lang.Object
  extended by com.caucho.amber.ejb3.QueryImpl
All Implemented Interfaces:
Query

public class QueryImpl
extends java.lang.Object
implements Query

The EJB query


Method Summary
protected  java.sql.ResultSet executeQuery()
          Executes the query returning a result set.
 int executeUpdate()
          Execute an update or delete.
 int getFirstResult()
          The first to retrieve.
 FlushModeType getFlushMode()
          Gets the flush type.
 java.util.Map getHints()
          Returns the implementation-specific hints
 LockModeType getLockMode()
          Gets the lock type.
 int getMaxResults()
          The maximum number of results to retrieve.
 java.util.Map getNamedParameters()
          Returns the named parameters as a map
 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 getPositionalParameters()
          Returns the positional parameters as a list
 java.util.List getResultList()
          Execute the query and return as a List.
 java.lang.Object getSingleResult()
          Returns a single result.
 java.util.Set<java.lang.String> getSupportedHints()
          Returns the supported hints
 boolean isBound(Parameter<?> param)
           
 Query setDouble(int index, double value)
          Sets an indexed parameter.
 Query setFirstResult(int startPosition)
          Sets the position of the first result.
 Query setFlushMode(FlushModeType mode)
          Sets the flush mode type.
 Query setHint(java.lang.String hintName, java.lang.Object value)
          Sets a hint.
 Query setLockMode(LockModeType lockMode)
          Sets the lock type.
 Query setMaxResults(int maxResult)
          Sets the maximum result returned.
 Query setParameter(int index, java.util.Calendar value, TemporalType type)
          Sets a calendar parameter.
 Query setParameter(int index, java.util.Date value, TemporalType type)
          Sets a date parameter.
 Query setParameter(int index, java.lang.Object value)
          Sets an indexed 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 value, TemporalType type)
          Sets a calendar parameter.
 Query setParameter(java.lang.String name, java.util.Date value, TemporalType type)
          Sets a date parameter.
 Query setParameter(java.lang.String name, java.lang.Object value)
          Sets a named parameter.
<T> T
unwrap(java.lang.Class<T> cl)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getResultList

public java.util.List getResultList()
Execute the query and return as a List.

Specified by:
getResultList in interface Query

getSingleResult

public java.lang.Object getSingleResult()
Returns a single result.

Specified by:
getSingleResult in interface Query

executeUpdate

public int executeUpdate()
Execute an update or delete.

Specified by:
executeUpdate in interface Query

executeQuery

protected java.sql.ResultSet executeQuery()
                                   throws java.sql.SQLException
Executes the query returning a result set.

Throws:
java.sql.SQLException

setMaxResults

public Query setMaxResults(int maxResult)
Sets the maximum result returned.

Specified by:
setMaxResults in interface Query

setFirstResult

public Query setFirstResult(int startPosition)
Sets the position of the first result.

Specified by:
setFirstResult in interface Query

setHint

public Query setHint(java.lang.String hintName,
                     java.lang.Object value)
Sets a hint.

Specified by:
setHint in interface Query

setParameter

public Query setParameter(java.lang.String name,
                          java.lang.Object value)
Sets a named parameter.

Specified by:
setParameter in interface Query

setParameter

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

Specified by:
setParameter in interface Query

setParameter

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

Specified by:
setParameter in interface Query

setParameter

public Query setParameter(int index,
                          java.lang.Object value)
Sets an indexed parameter.

Specified by:
setParameter in interface Query

setParameter

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

Specified by:
setParameter in interface Query

setParameter

public Query setParameter(int index,
                          java.util.Calendar value,
                          TemporalType type)
Sets a calendar parameter.

Specified by:
setParameter in interface Query

setFlushMode

public Query setFlushMode(FlushModeType mode)
Sets the flush mode type.

Specified by:
setFlushMode in interface Query

setDouble

public Query setDouble(int index,
                       double value)
Sets an indexed parameter.


getMaxResults

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

Specified by:
getMaxResults in interface Query

getFirstResult

public int getFirstResult()
The first to retrieve.

Specified by:
getFirstResult in interface Query

getHints

public java.util.Map getHints()
Returns the implementation-specific hints

Specified by:
getHints in interface Query

getSupportedHints

public java.util.Set<java.lang.String> getSupportedHints()
Returns the supported hints


getNamedParameters

public java.util.Map getNamedParameters()
Returns the named parameters as a map

Since:
JPA 2.0

getPositionalParameters

public java.util.List getPositionalParameters()
Returns the positional parameters as a list

Since:
JPA 2.0

getFlushMode

public FlushModeType getFlushMode()
Gets the flush type.

Specified by:
getFlushMode in interface Query
Since:
JPA 2.0

setLockMode

public Query setLockMode(LockModeType lockMode)
Sets the lock type.

Specified by:
setLockMode in interface Query
Since:
JPA 2.0

getLockMode

public LockModeType getLockMode()
Gets the lock type.

Specified by:
getLockMode in interface Query
Since:
JPA 2.0

getParameter

public Parameter<?> getParameter(java.lang.String name)
Specified by:
getParameter in interface Query

getParameter

public <T> Parameter<T> getParameter(java.lang.String name,
                                     java.lang.Class<T> type)
Specified by:
getParameter in interface Query

getParameter

public Parameter<?> getParameter(int pos)
Specified by:
getParameter in interface Query

getParameter

public <T> Parameter<T> getParameter(int position,
                                     java.lang.Class<T> type)
Specified by:
getParameter in interface Query

getParameterValue

public <T> T getParameterValue(Parameter<T> param)
Specified by:
getParameterValue in interface Query

getParameterValue

public java.lang.Object getParameterValue(java.lang.String name)
Specified by:
getParameterValue in interface Query

getParameterValue

public java.lang.Object getParameterValue(int position)
Specified by:
getParameterValue in interface Query

getParameters

public java.util.Set<Parameter<?>> getParameters()
Specified by:
getParameters in interface Query

isBound

public boolean isBound(Parameter<?> param)
Specified by:
isBound in interface Query

setParameter

public <T> Query setParameter(Parameter<T> param,
                              T value)
Description copied from interface: Query
Binds a named parameter.

Specified by:
setParameter in interface Query

setParameter

public Query setParameter(Parameter<java.util.Calendar> param,
                          java.util.Calendar date,
                          TemporalType type)
Description copied from interface: Query
Sets a calendar parameter.

Specified by:
setParameter in interface Query

setParameter

public Query setParameter(Parameter<java.util.Date> param,
                          java.util.Date value,
                          TemporalType temporalType)
Description copied from interface: Query
Sets a date parameter.

Specified by:
setParameter in interface Query

unwrap

public <T> T unwrap(java.lang.Class<T> cl)
Specified by:
unwrap in interface Query