| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.openjpa.persistence.QueryImpl<X>
public class QueryImpl<X>
Implementation of Query interface.
| Field Summary | 
|---|
| Fields inherited from interface org.apache.openjpa.persistence.OpenJPAQuery | 
|---|
| FLUSH_FALSE, FLUSH_TRUE, FLUSH_WITH_CONNECTION, HINT_RESULT_COUNT, OP_DELETE, OP_SELECT, OP_UPDATE | 
| Constructor Summary | |
|---|---|
| QueryImpl(EntityManagerImpl em,
          Query query)Deprecated. | |
| QueryImpl(EntityManagerImpl em,
          RuntimeExceptionTranslator ret,
          Query query)Constructor; supply factory exception translator and delegate. | |
| Method Summary | ||
|---|---|---|
|  OpenJPAQuery<X> | addAggregateListener(AggregateListener listener)Register an aggregate listener for the query. | |
|  OpenJPAQuery<X> | addFilterListener(FilterListener listener)Register a filter listener for the query. | |
| (package private)  void | assertBound(Parameter<?> param) | |
| (package private)  void | assertJPQLOrCriteriaQuery()Asserts that this query is a JPQL or Criteria Query. | |
| (package private)  Object | assertValueAssignable(Parameter<?> param,
                      Object v)Convert the given value to match the given parameter type, if possible. | |
| (package private)  void | bindValue(Parameter<?> param,
          Object value)Binds the given value to the given parameter. | |
| (package private)  int | calculateMaxKey(Set<Integer> p)Calculate the maximum value of the given set. | |
| (package private)  void | clearBinding() | |
|  OpenJPAQuery<X> | closeAll()Close all open query results. | |
|  OpenJPAQuery<X> | compile()Compile the query. | |
| (package private)  Object | convertTemporalType(Calendar value,
                    TemporalType type) | |
| (package private)  Object | convertTemporalType(Date value,
                    TemporalType type)Converts the given Date to a value corresponding to given temporal type. | |
|  void | declareParameter(Object key,
                 Parameter<?> param)Declares the given parameter for this query. | |
|  boolean | equals(Object other) | |
|  int | executeUpdate() | |
|  Set<?> | getBoundParameterKeys()Gets the parameter keys bound with this query. | |
|  Collection<?> | getCandidateCollection()Return the candidate collection, or nullif 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. | |
|  Set<?> | getDeclaredParameterKeys()Gets the declared parameter keys in the given query. | |
| 
 | getDeclaredParameterKeys(Class<T> keyType) | |
|  Map<Object,Parameter<?>> | getDeclaredParameters()Gets the parameter instances declared in this query. | |
|  Query | getDelegate()Delegate. | |
|  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. | |
|  Map<String,Object> | getHints()Get all the active hints and their values. | |
|  boolean | getIgnoreChanges()Whether to ignore changes in the current transaction. | |
|  String | getLanguage()Query language. | |
|  LockModeType | getLockMode() | |
|  int | getMaxResults()Return the maximum number of results to retrieve. | |
|  Map<String,Object> | getNamedParameters()Gets the value of all the named parameters. | |
|  QueryOperationType | getOperation()Query operation type. | |
|  Parameter<?> | getParameter(int pos)Get the positional parameter with the given position. | |
| 
 | getParameter(int pos,
             Class<T> type)Get the positional parameter with the given position and type. | |
|  Parameter<?> | getParameter(String name)Get the parameter object corresponding to the declared parameter of the given name. | |
| 
 | getParameter(String name,
             Class<T> type)Get the parameter of the given name and type. | |
|  Set<Parameter<?>> | getParameters()Gets the parameters declared in this query. | |
|  Object | getParameterValue(int pos)Return the value bound to the parameter. | |
| 
 | getParameterValue(Parameter<T> p)Return the value bound to the parameter. | |
|  Object | getParameterValue(String name)Return the value bound to the parameter. | |
| (package private)  Map<Object,Object> | getParameterValues()Gets a map of values of each parameter indexed by their original key. | |
|  Object[] | getPositionalParameters()Gets the array of positional parameter values. | |
|  String | getQueryString()Query string. | |
|  boolean | getRelaxBindParameterTypeChecking()Gets whether the type of user-supplied bind parameter value and the type of target persistent property they bind to are checked with strong or weak constraint. | |
|  Class | getResultClass()Query result element type. | |
|  List | getResultList() | |
|  X | getSingleResult()Execute a query that returns a single result. | |
|  Set<String> | getSupportedHints()Gets hints supported by this query. | |
|  int | hashCode() | |
|  boolean | hasPositionalParameters()Affirms if declared parameters use position identifier. | |
|  boolean | hasSubclasses()Whether subclasses are included in the query results. | |
| (package private)  void | ignorePreparedQuery()Ignores this query from PreparedQueryCache by recreating the original query if it has been cached. | |
| (package private)  boolean | invalidatePreparedQuery()Remove this query from PreparedQueryCache. | |
|  boolean | isBound(Parameter<?> param)Affirms if the given parameter is bound to a value for this query. | |
|  boolean | isNative() | |
| (package private)  void | lock() | |
|  OpenJPAQuery<X> | removeAggregateListener(AggregateListener listener)Remove an aggregate listener from the query. | |
|  OpenJPAQuery<X> | removeFilterListener(FilterListener listener)Remove a filter listener from the query. | |
|  OpenJPAQuery<X> | setCandidateCollection(Collection coll)Set a collection of candidates. | |
|  OpenJPAQuery<X> | setFirstResult(int startPosition) | |
|  OpenJPAQuery<X> | setFlushMode(FlushModeType flushMode) | |
|  OpenJPAQuery<X> | setHint(String key,
        Object value) | |
| (package private)  QueryImpl | setId(String id) | |
|  OpenJPAQuery<X> | setIgnoreChanges(boolean ignore)Whether to ignore changes in the current transaction. | |
|  TypedQuery<X> | setLockMode(LockModeType lockMode)Sets lock mode on the given query. | |
|  OpenJPAQuery<X> | setMaxResults(int max) | |
|  OpenJPAQuery<X> | setParameter(int position,
             Calendar value,
             TemporalType t)Sets the value of the given positional parameter after conversion of the given value to the given Temporal Type. | |
|  OpenJPAQuery<X> | setParameter(int position,
             Date value,
             TemporalType type)Sets the value of the given named parameter after conversion of the given value to the given Temporal Type. | |
|  OpenJPAQuery<X> | setParameter(int pos,
             Object value)Binds the parameter identified by the given position to the given value. | |
|  TypedQuery<X> | setParameter(Parameter<Calendar> p,
             Calendar cal,
             TemporalType type) | |
|  OpenJPAQuery<X> | setParameter(Parameter<Date> p,
             Date date,
             TemporalType type) | |
| 
 | setParameter(Parameter<T> p,
             T arg1) | |
|  OpenJPAQuery<X> | setParameter(String name,
             Calendar value,
             TemporalType type) | |
|  OpenJPAQuery<X> | setParameter(String name,
             Date value,
             TemporalType type) | |
|  OpenJPAQuery<X> | setParameter(String name,
             Object value)Sets the parameter of the given name to the given value. | |
|  OpenJPAQuery<X> | setParameters(Map params)Sets the values of the parameters from the given Map. | |
|  OpenJPAQuery<X> | setParameters(Object... params)Binds the given values as positional parameters. | |
|  void | setRelaxBindParameterTypeChecking(Object value)Sets whether the type of user-supplied bind parameter value and the type of target persistent property they bind to are checked with strong or weak constraint. | |
|  OpenJPAQuery<X> | setResultClass(Class cls)Query result element type. | |
|  OpenJPAQuery<X> | setSubclasses(boolean subs)Whether subclasses are included in the query results. | |
|  String | toString() | |
| (package private)  void | unlock() | |
| 
 | unwrap(Class<T> cls)Unwraps this receiver to an instance of the given class, if possible. | |
| Methods inherited from class java.lang.Object | 
|---|
| clone, finalize, getClass, notify, notifyAll, wait, wait, wait | 
| Constructor Detail | 
|---|
public QueryImpl(EntityManagerImpl em,
                 RuntimeExceptionTranslator ret,
                 Query query)
em - The EntityManager which created this queryret - Exception translator for this queryquery - The underlying "kernel" query.
public QueryImpl(EntityManagerImpl em,
                 Query query)
| Method Detail | 
|---|
public Query getDelegate()
public OpenJPAEntityManager getEntityManager()
OpenJPAQuery
getEntityManager in interface OpenJPAQuery<X>public String getLanguage()
OpenJPAQuery
getLanguage in interface OpenJPAQuery<X>public QueryOperationType getOperation()
OpenJPAQuery
getOperation in interface OpenJPAQuery<X>public FetchPlan getFetchPlan()
OpenJPAQuery
getFetchPlan in interface OpenJPAQuery<X>public String getQueryString()
OpenJPAQuery
getQueryString in interface OpenJPAQuery<X>public boolean getIgnoreChanges()
OpenJPAQuery
getIgnoreChanges in interface OpenJPAQuery<X>public OpenJPAQuery<X> setIgnoreChanges(boolean ignore)
OpenJPAQuery
setIgnoreChanges in interface OpenJPAQuery<X>public OpenJPAQuery<X> addFilterListener(FilterListener listener)
OpenJPAQuerySPI
addFilterListener in interface OpenJPAQuery<X>addFilterListener in interface OpenJPAQuerySPI<X>public OpenJPAQuery<X> removeFilterListener(FilterListener listener)
OpenJPAQuerySPI
removeFilterListener in interface OpenJPAQuery<X>removeFilterListener in interface OpenJPAQuerySPI<X>public OpenJPAQuery<X> addAggregateListener(AggregateListener listener)
OpenJPAQuerySPI
addAggregateListener in interface OpenJPAQuery<X>addAggregateListener in interface OpenJPAQuerySPI<X>public OpenJPAQuery<X> removeAggregateListener(AggregateListener listener)
OpenJPAQuerySPI
removeAggregateListener in interface OpenJPAQuery<X>removeAggregateListener in interface OpenJPAQuerySPI<X>public Collection<?> getCandidateCollection()
OpenJPAQuerynull if an
 extent was specified instead of a collection.
getCandidateCollection in interface OpenJPAQuery<X>public OpenJPAQuery<X> setCandidateCollection(Collection coll)
OpenJPAQuery
setCandidateCollection in interface OpenJPAQuery<X>public Class getResultClass()
OpenJPAQuery
getResultClass in interface OpenJPAQuery<X>public OpenJPAQuery<X> setResultClass(Class cls)
OpenJPAQuery
setResultClass in interface OpenJPAQuery<X>public boolean hasSubclasses()
OpenJPAQuery
hasSubclasses in interface OpenJPAQuery<X>public OpenJPAQuery<X> setSubclasses(boolean subs)
OpenJPAQuery
setSubclasses in interface OpenJPAQuery<X>public int getFirstResult()
OpenJPAQuery
getFirstResult in interface QuerygetFirstResult in interface OpenJPAQuery<X>public OpenJPAQuery<X> setFirstResult(int startPosition)
setFirstResult in interface QuerysetFirstResult in interface TypedQuery<X>setFirstResult in interface OpenJPAQuery<X>public int getMaxResults()
OpenJPAQueryInteger.MAX_VALUE for no limit.
getMaxResults in interface QuerygetMaxResults in interface OpenJPAQuery<X>public OpenJPAQuery<X> setMaxResults(int max)
setMaxResults in interface QuerysetMaxResults in interface TypedQuery<X>setMaxResults in interface OpenJPAQuery<X>public boolean getRelaxBindParameterTypeChecking()
OpenJPAQuery
getRelaxBindParameterTypeChecking in interface OpenJPAQuery<X>public void setRelaxBindParameterTypeChecking(Object value)
OpenJPAQueryhint without puncturing standard
 JPA API.
setRelaxBindParameterTypeChecking in interface OpenJPAQuery<X>value - a String or Boolean value.Filters.canConvert(Class, Class, boolean), 
Filters.convert(Object, Class, boolean)public OpenJPAQuery<X> compile()
OpenJPAQuery
compile in interface OpenJPAQuery<X>Map<Object,Object> getParameterValues()
public List getResultList()
getResultList in interface QuerygetResultList in interface TypedQuery<X>public X getSingleResult()
getSingleResult in interface QuerygetSingleResult in interface TypedQuery<X>public int executeUpdate()
executeUpdate in interface Querypublic FlushModeType getFlushMode()
OpenJPAQuery
getFlushMode in interface QuerygetFlushMode in interface OpenJPAQuery<X>public OpenJPAQuery<X> setFlushMode(FlushModeType flushMode)
setFlushMode in interface QuerysetFlushMode in interface TypedQuery<X>setFlushMode in interface OpenJPAQuery<X>public boolean isNative()
void assertJPQLOrCriteriaQuery()
public OpenJPAQuery<X> closeAll()
OpenJPAQuery
closeAll in interface OpenJPAQuery<X>public String[] getDataStoreActions(Map params)
OpenJPAQuery
getDataStoreActions in interface OpenJPAQuery<X>params - the named parameter map for the query invocationpublic LockModeType getLockMode()
getLockMode in interface Querypublic TypedQuery<X> setLockMode(LockModeType lockMode)
setLockMode in interface QuerysetLockMode in interface TypedQuery<X>ignorePreparedQuery()public int hashCode()
hashCode in class Objectpublic boolean equals(Object other)
equals in class Objectpublic Map<String,Object> getHints()
getHints in interface Query
public OpenJPAQuery<X> setHint(String key,
                               Object value)
setHint in interface QuerysetHint in interface TypedQuery<X>setHint in interface OpenJPAQuery<X>public Set<String> getSupportedHints()
OpenJPAQuery
getSupportedHints in interface OpenJPAQuery<X>public <T> T unwrap(Class<T> cls)
unwrap in interface Queryif - the given class is null, generic Object.class or a class
 that is not wrapped by this receiver.boolean invalidatePreparedQuery()
void ignorePreparedQuery()
QueryImpl setId(String id)
void lock()
void unlock()
public OpenJPAQuery<X> setParameter(int pos,
                                    Object value)
setParameter in interface QuerysetParameter in interface TypedQuery<X>setParameter in interface OpenJPAQuery<X>position - positive, integer position of the parametervalue - an assignment compatible value
IllegalArgumentException - if position does not correspond to a positional 
 parameter of the query or if the argument is of incorrect type
public OpenJPAQuery<X> setParameter(int position,
                                    Calendar value,
                                    TemporalType t)
setParameter in interface QuerysetParameter in interface TypedQuery<X>setParameter in interface OpenJPAQuery<X>
public OpenJPAQuery<X> setParameter(int position,
                                    Date value,
                                    TemporalType type)
setParameter in interface QuerysetParameter in interface TypedQuery<X>setParameter in interface OpenJPAQuery<X>
Object convertTemporalType(Date value,
                           TemporalType type)
Object convertTemporalType(Calendar value,
                           TemporalType type)
public boolean hasPositionalParameters()
hasPositionalParameters in interface OpenJPAQuery<X>public Object[] getPositionalParameters()
getPositionalParameters in interface OpenJPAQuery<X>int calculateMaxKey(Set<Integer> p)
public OpenJPAQuery<X> setParameters(Object... params)
setParameters in interface OpenJPAQuery<X>void clearBinding()
public Map<String,Object> getNamedParameters()
getNamedParameters in interface OpenJPAQuery<X>public OpenJPAQuery<X> setParameters(Map params)
setParameters in interface OpenJPAQuery<X>
public <T> Parameter<T> getParameter(String name,
                                     Class<T> type)
getParameter in interface QueryIllegalArgumentException - if the parameter of the
         specified name does not exist or is not assignable
         to the type
IllegalStateException - if invoked on a native query
public <T> Parameter<T> getParameter(int pos,
                                     Class<T> type)
getParameter in interface QueryIllegalArgumentException - if the parameter with the
         specified position does not exist or is not assignable
         to the type
IllegalStateException - if invoked on a native query unless
 the same parameter position is bound already.public <T> T getParameterValue(Parameter<T> p)
getParameterValue in interface Queryparam - parameter object
IllegalStateException - if the parameter has not been been bound
IllegalArgumentException - if the parameter does not belong to this querypublic Set<Parameter<?>> getParameters()
getParameters in interface Query
public <T> OpenJPAQuery<X> setParameter(Parameter<T> p,
                                        T arg1)
setParameter in interface QuerysetParameter in interface TypedQuery<X>
public OpenJPAQuery<X> setParameter(Parameter<Date> p,
                                    Date date,
                                    TemporalType type)
setParameter in interface QuerysetParameter in interface TypedQuery<X>
public TypedQuery<X> setParameter(Parameter<Calendar> p,
                                  Calendar cal,
                                  TemporalType type)
setParameter in interface QuerysetParameter in interface TypedQuery<X>public Parameter<?> getParameter(String name)
getParameter in interface QueryIllegalArgumentException - if the parameter of the specified name does not exist
IllegalStateException - if invoked on a native querypublic Parameter<?> getParameter(int pos)
getParameter in interface Queryposition - specified in the user query.
IllegalArgumentException - if the parameter with the given position does not existpublic Object getParameterValue(String name)
getParameterValue in interface Queryname - name of the parameter
IllegalStateException - if this parameter has not been boundpublic Object getParameterValue(int pos)
getParameterValue in interface Querypos - position of the parameter
IllegalStateException - if this parameter has not been boundpublic Set<?> getBoundParameterKeys()
public Set<?> getDeclaredParameterKeys()
public <T> Set<T> getDeclaredParameterKeys(Class<T> keyType)
public Map<Object,Parameter<?>> getDeclaredParameters()
public void declareParameter(Object key,
                             Parameter<?> param)
key - this is the key to identify the parameter later in the context of this query.
 Valid key types are Integer, String or ParameterExpression itself.the - parameter instance to be declaredpublic boolean isBound(Parameter<?> param)
isBound in interface Queryvoid assertBound(Parameter<?> param)
void bindValue(Parameter<?> param,
               Object value)
public OpenJPAQuery<X> setParameter(String name,
                                    Calendar value,
                                    TemporalType type)
setParameter in interface QuerysetParameter in interface TypedQuery<X>setParameter in interface OpenJPAQuery<X>
public OpenJPAQuery<X> setParameter(String name,
                                    Date value,
                                    TemporalType type)
setParameter in interface QuerysetParameter in interface TypedQuery<X>setParameter in interface OpenJPAQuery<X>
public OpenJPAQuery<X> setParameter(String name,
                                    Object value)
setParameter in interface QuerysetParameter in interface TypedQuery<X>setParameter in interface OpenJPAQuery<X>
Object assertValueAssignable(Parameter<?> param,
                             Object v)
param - a query parameterv - a user-supplied value for the parameterpublic String toString()
toString in class Object| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||