org.apache.openjpa.persistence
Interface OpenJPAQuery

All Superinterfaces:
Query
All Known Subinterfaces:
OpenJPAQuerySPI
All Known Implementing Classes:
QueryImpl

public interface OpenJPAQuery
extends Query

Interface implemented by OpenJPA queries.

Since:
0.4.0
Author:
Abe White

Field Summary
static String HINT_RESULT_COUNT
          Hint key for specifying the number of rows to optimize for.
 
Method Summary
 OpenJPAQuery closeAll()
          Close all open query results.
 OpenJPAQuery compile()
          Compile the query.
 Collection getCandidateCollection()
          Return the candidate collection, or null if an extent was specified instead of a collection.
 String[] getDataStoreActions(Map params)
          Returns a description of the commands that will be sent to the datastore in order to execute this query.
 OpenJPAEntityManager getEntityManager()
          The owning entity manager.
 FetchPlan getFetchPlan()
          Fetch plan for controlling the loading of results.
 int getFirstResult()
          Return the 0-based start index for the returned results.
 FlushModeType getFlushMode()
          Return the current flush mode.
 boolean getIgnoreChanges()
          Whether to ignore changes in the current transaction.
 String getLanguage()
          Query language.
 int getMaxResults()
          Return the maximum number of results to retrieve.
 Map getNamedParameters()
          The named parameters for the query; empty map if none or if query uses named parameters.
 QueryOperationType getOperation()
          Query operation type.
 Object[] getPositionalParameters()
          The positional parameters for the query; empty array if none or if query uses named parameters.
 String getQueryString()
          Query string.
 Class getResultClass()
          Query result element type.
 boolean hasPositionalParameters()
          Whether this query has positional parameters.
 boolean hasSubclasses()
          Whether subclasses are included in the query results.
 OpenJPAQuery setCandidateCollection(Collection coll)
          Set a collection of candidates.
 OpenJPAQuery setFirstResult(int startPosition)
           
 OpenJPAQuery setFlushMode(FlushModeType flushMode)
           
 OpenJPAQuery setHint(String hintName, Object value)
           
 OpenJPAQuery setIgnoreChanges(boolean ignore)
          Whether to ignore changes in the current transaction.
 OpenJPAQuery setMaxResults(int maxResult)
           
 OpenJPAQuery setParameter(int position, Calendar value, TemporalType temporalType)
           
 OpenJPAQuery setParameter(int position, Date value, TemporalType temporalType)
           
 OpenJPAQuery setParameter(int position, Object value)
           
 OpenJPAQuery setParameter(String name, Calendar value, TemporalType temporalType)
           
 OpenJPAQuery setParameter(String name, Date value, TemporalType temporalType)
           
 OpenJPAQuery setParameter(String name, Object value)
           
 OpenJPAQuery setParameters(Map params)
          Set parameters.
 OpenJPAQuery setParameters(Object... params)
          Set parameters.
 OpenJPAQuery setResultClass(Class type)
          Query result element type.
 OpenJPAQuery setSubclasses(boolean subs)
          Whether subclasses are included in the query results.
 
Methods inherited from interface javax.persistence.Query
executeUpdate, getResultList, getSingleResult
 

Field Detail

HINT_RESULT_COUNT

static final String HINT_RESULT_COUNT
Hint key for specifying the number of rows to optimize for.

See Also:
Constant Field Values
Method Detail

getEntityManager

OpenJPAEntityManager getEntityManager()
The owning entity manager.


getLanguage

String getLanguage()
Query language.


getOperation

QueryOperationType getOperation()
Query operation type.


getFetchPlan

FetchPlan getFetchPlan()
Fetch plan for controlling the loading of results.


getQueryString

String getQueryString()
Query string.


getIgnoreChanges

boolean getIgnoreChanges()
Whether to ignore changes in the current transaction.


setIgnoreChanges

OpenJPAQuery setIgnoreChanges(boolean ignore)
Whether to ignore changes in the current transaction.


getCandidateCollection

Collection getCandidateCollection()
Return the candidate collection, or null if an extent was specified instead of a collection.


setCandidateCollection

OpenJPAQuery setCandidateCollection(Collection coll)
Set a collection of candidates.


getResultClass

Class getResultClass()
Query result element type.


setResultClass

OpenJPAQuery setResultClass(Class type)
Query result element type.


hasSubclasses

boolean hasSubclasses()
Whether subclasses are included in the query results.


setSubclasses

OpenJPAQuery setSubclasses(boolean subs)
Whether subclasses are included in the query results.


getFirstResult

int getFirstResult()
Return the 0-based start index for the returned results.


getMaxResults

int getMaxResults()
Return the maximum number of results to retrieve. or Integer.MAX_VALUE for no limit.


compile

OpenJPAQuery compile()
Compile the query.


hasPositionalParameters

boolean hasPositionalParameters()
Whether this query has positional parameters.


getPositionalParameters

Object[] getPositionalParameters()
The positional parameters for the query; empty array if none or if query uses named parameters.


getNamedParameters

Map getNamedParameters()
The named parameters for the query; empty map if none or if query uses named parameters.


setParameters

OpenJPAQuery setParameters(Map params)
Set parameters.


setParameters

OpenJPAQuery setParameters(Object... params)
Set parameters.


closeAll

OpenJPAQuery closeAll()
Close all open query results.


getDataStoreActions

String[] getDataStoreActions(Map params)
Returns a description of the commands that will be sent to the datastore in order to execute this query. This will typically be in the native query language of the database (e.g., SQL).

Parameters:
params - the named parameter map for the query invocation

setMaxResults

OpenJPAQuery setMaxResults(int maxResult)
Specified by:
setMaxResults in interface Query

setFirstResult

OpenJPAQuery setFirstResult(int startPosition)
Specified by:
setFirstResult in interface Query

setHint

OpenJPAQuery setHint(String hintName,
                     Object value)
Specified by:
setHint in interface Query

setParameter

OpenJPAQuery setParameter(String name,
                          Object value)
Specified by:
setParameter in interface Query

setParameter

OpenJPAQuery setParameter(String name,
                          Date value,
                          TemporalType temporalType)
Specified by:
setParameter in interface Query

setParameter

OpenJPAQuery setParameter(String name,
                          Calendar value,
                          TemporalType temporalType)
Specified by:
setParameter in interface Query

setParameter

OpenJPAQuery setParameter(int position,
                          Object value)
Specified by:
setParameter in interface Query

setParameter

OpenJPAQuery setParameter(int position,
                          Date value,
                          TemporalType temporalType)
Specified by:
setParameter in interface Query

setParameter

OpenJPAQuery setParameter(int position,
                          Calendar value,
                          TemporalType temporalType)
Specified by:
setParameter in interface Query

setFlushMode

OpenJPAQuery setFlushMode(FlushModeType flushMode)
Specified by:
setFlushMode in interface Query

getFlushMode

FlushModeType getFlushMode()
Return the current flush mode.



Copyright © 2006-2007 Apache Software Foundation. All Rights Reserved.