org.apache.openjpa.persistence
public class QueryImpl<X> extends Object implements OpenJPAQuerySPI<X>, Serializable
Query interface.FLUSH_FALSE, FLUSH_TRUE, FLUSH_WITH_CONNECTION, HINT_RESULT_COUNT, OP_DELETE, OP_SELECT, OP_UPDATE| Constructor and Description |
|---|
QueryImpl(EntityManagerImpl em,
Query query)
Deprecated.
|
QueryImpl(EntityManagerImpl em,
RuntimeExceptionTranslator ret,
Query query)
Constructor; supply factory exception translator and delegate.
|
| Modifier and Type | Method and Description |
|---|---|
OpenJPAQuery<X> |
addAggregateListener(AggregateListener listener)
Register an aggregate listener for the query.
|
OpenJPAQuery<X> |
addFilterListener(FilterListener listener)
Register a filter listener for the query.
|
OpenJPAQuery<X> |
closeAll()
Close all open query results.
|
OpenJPAQuery<X> |
compile()
Compile the query.
|
void |
declareParameter(Object key,
javax.persistence.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
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.
|
Set<?> |
getDeclaredParameterKeys()
Gets the declared parameter keys in the given query.
|
<T> Set<T> |
getDeclaredParameterKeys(Class<T> keyType) |
Map<Object,javax.persistence.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.
|
javax.persistence.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.
|
javax.persistence.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.
|
javax.persistence.Parameter<?> |
getParameter(int pos)
Get the positional parameter with the given position.
|
<T> javax.persistence.Parameter<T> |
getParameter(int pos,
Class<T> type)
Get the positional parameter with the given position and type.
|
javax.persistence.Parameter<?> |
getParameter(String name)
Get the parameter object corresponding to the declared parameter of the given name.
|
<T> javax.persistence.Parameter<T> |
getParameter(String name,
Class<T> type)
Get the parameter of the given name and type.
|
Set<javax.persistence.Parameter<?>> |
getParameters()
Gets the parameters declared in this query.
|
Object |
getParameterValue(int pos)
Return the value bound to the parameter.
|
<T> T |
getParameterValue(javax.persistence.Parameter<T> p)
Return the value bound to the parameter.
|
Object |
getParameterValue(String name)
Return the value bound to the parameter.
|
Object[] |
getPositionalParameters()
Gets the array of positional parameter values.
|
String |
getQueryString()
Query string.
|
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.
|
boolean |
isBound(javax.persistence.Parameter<?> param)
Affirms if the given parameter is bound to a value for this query.
|
boolean |
isNative() |
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(javax.persistence.FlushModeType flushMode) |
OpenJPAQuery<X> |
setHint(String key,
Object value) |
OpenJPAQuery<X> |
setIgnoreChanges(boolean ignore)
Whether to ignore changes in the current transaction.
|
javax.persistence.TypedQuery<X> |
setLockMode(javax.persistence.LockModeType lockMode)
Sets lock mode on the given query.
|
OpenJPAQuery<X> |
setMaxResults(int max) |
OpenJPAQuery<X> |
setParameter(int position,
Calendar value,
javax.persistence.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,
javax.persistence.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.
|
javax.persistence.TypedQuery<X> |
setParameter(javax.persistence.Parameter<Calendar> p,
Calendar cal,
javax.persistence.TemporalType type) |
OpenJPAQuery<X> |
setParameter(javax.persistence.Parameter<Date> p,
Date date,
javax.persistence.TemporalType type) |
<T> OpenJPAQuery<X> |
setParameter(javax.persistence.Parameter<T> p,
T arg1) |
OpenJPAQuery<X> |
setParameter(String name,
Calendar value,
javax.persistence.TemporalType type) |
OpenJPAQuery<X> |
setParameter(String name,
Date value,
javax.persistence.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.
|
OpenJPAQuery<X> |
setResultClass(Class cls)
Query result element type.
|
OpenJPAQuery<X> |
setSubclasses(boolean subs)
Whether subclasses are included in the query results.
|
String |
toString() |
<T> T |
unwrap(Class<T> cls)
Unwraps this receiver to an instance of the given class, if possible.
|
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)
public Query getDelegate()
public OpenJPAEntityManager getEntityManager()
OpenJPAQuerygetEntityManager in interface OpenJPAQuery<X>public String getLanguage()
OpenJPAQuerygetLanguage in interface OpenJPAQuery<X>public QueryOperationType getOperation()
OpenJPAQuerygetOperation in interface OpenJPAQuery<X>public FetchPlan getFetchPlan()
OpenJPAQuerygetFetchPlan in interface OpenJPAQuery<X>public String getQueryString()
OpenJPAQuerygetQueryString in interface OpenJPAQuery<X>public boolean getIgnoreChanges()
OpenJPAQuerygetIgnoreChanges in interface OpenJPAQuery<X>public OpenJPAQuery<X> setIgnoreChanges(boolean ignore)
OpenJPAQuerysetIgnoreChanges in interface OpenJPAQuery<X>public OpenJPAQuery<X> addFilterListener(FilterListener listener)
OpenJPAQuerySPIaddFilterListener in interface OpenJPAQuery<X>addFilterListener in interface OpenJPAQuerySPI<X>public OpenJPAQuery<X> removeFilterListener(FilterListener listener)
OpenJPAQuerySPIremoveFilterListener in interface OpenJPAQuery<X>removeFilterListener in interface OpenJPAQuerySPI<X>public OpenJPAQuery<X> addAggregateListener(AggregateListener listener)
OpenJPAQuerySPIaddAggregateListener in interface OpenJPAQuery<X>addAggregateListener in interface OpenJPAQuerySPI<X>public OpenJPAQuery<X> removeAggregateListener(AggregateListener listener)
OpenJPAQuerySPIremoveAggregateListener 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)
OpenJPAQuerysetCandidateCollection in interface OpenJPAQuery<X>public Class getResultClass()
OpenJPAQuerygetResultClass in interface OpenJPAQuery<X>public OpenJPAQuery<X> setResultClass(Class cls)
OpenJPAQuerysetResultClass in interface OpenJPAQuery<X>public boolean hasSubclasses()
OpenJPAQueryhasSubclasses in interface OpenJPAQuery<X>public OpenJPAQuery<X> setSubclasses(boolean subs)
OpenJPAQuerysetSubclasses in interface OpenJPAQuery<X>public int getFirstResult()
OpenJPAQuerygetFirstResult in interface javax.persistence.QuerygetFirstResult in interface OpenJPAQuery<X>public OpenJPAQuery<X> setFirstResult(int startPosition)
setFirstResult in interface javax.persistence.QuerysetFirstResult in interface javax.persistence.TypedQuery<X>setFirstResult in interface OpenJPAQuery<X>public int getMaxResults()
OpenJPAQueryInteger.MAX_VALUE for no limit.getMaxResults in interface javax.persistence.QuerygetMaxResults in interface OpenJPAQuery<X>public OpenJPAQuery<X> setMaxResults(int max)
setMaxResults in interface javax.persistence.QuerysetMaxResults in interface javax.persistence.TypedQuery<X>setMaxResults in interface OpenJPAQuery<X>public OpenJPAQuery<X> compile()
OpenJPAQuerycompile in interface OpenJPAQuery<X>public List getResultList()
getResultList in interface javax.persistence.QuerygetResultList in interface javax.persistence.TypedQuery<X>public X getSingleResult()
getSingleResult in interface javax.persistence.QuerygetSingleResult in interface javax.persistence.TypedQuery<X>public int executeUpdate()
executeUpdate in interface javax.persistence.Querypublic javax.persistence.FlushModeType getFlushMode()
OpenJPAQuerygetFlushMode in interface javax.persistence.QuerygetFlushMode in interface OpenJPAQuery<X>public OpenJPAQuery<X> setFlushMode(javax.persistence.FlushModeType flushMode)
setFlushMode in interface javax.persistence.QuerysetFlushMode in interface javax.persistence.TypedQuery<X>setFlushMode in interface OpenJPAQuery<X>public boolean isNative()
public OpenJPAQuery<X> closeAll()
OpenJPAQuerycloseAll in interface OpenJPAQuery<X>public String[] getDataStoreActions(Map params)
OpenJPAQuerygetDataStoreActions in interface OpenJPAQuery<X>params - the named parameter map for the query invocationpublic javax.persistence.LockModeType getLockMode()
getLockMode in interface javax.persistence.Querypublic javax.persistence.TypedQuery<X> setLockMode(javax.persistence.LockModeType lockMode)
setLockMode in interface javax.persistence.QuerysetLockMode in interface javax.persistence.TypedQuery<X>ignorePreparedQuery()public Map<String,Object> getHints()
getHints in interface javax.persistence.Querypublic OpenJPAQuery<X> setHint(String key, Object value)
setHint in interface javax.persistence.QuerysetHint in interface javax.persistence.TypedQuery<X>setHint in interface OpenJPAQuery<X>public Set<String> getSupportedHints()
OpenJPAQuerygetSupportedHints in interface OpenJPAQuery<X>public <T> T unwrap(Class<T> cls)
unwrap in interface javax.persistence.Queryif - the given class is null, generic Object.class or a class
that is not wrapped by this receiver.public OpenJPAQuery<X> setParameter(int pos, Object value)
setParameter in interface javax.persistence.QuerysetParameter in interface javax.persistence.TypedQuery<X>setParameter in interface OpenJPAQuery<X>position - positive, integer position of the parametervalue - an assignment compatible valueIllegalArgumentException - if position does not correspond to a positional
parameter of the query or if the argument is of incorrect typepublic OpenJPAQuery<X> setParameter(int position, Calendar value, javax.persistence.TemporalType t)
setParameter in interface javax.persistence.QuerysetParameter in interface javax.persistence.TypedQuery<X>setParameter in interface OpenJPAQuery<X>public OpenJPAQuery<X> setParameter(int position, Date value, javax.persistence.TemporalType type)
setParameter in interface javax.persistence.QuerysetParameter in interface javax.persistence.TypedQuery<X>setParameter in interface OpenJPAQuery<X>public boolean hasPositionalParameters()
hasPositionalParameters in interface OpenJPAQuery<X>public Object[] getPositionalParameters()
getPositionalParameters in interface OpenJPAQuery<X>public OpenJPAQuery<X> setParameters(Object... params)
setParameters in interface OpenJPAQuery<X>public Map<String,Object> getNamedParameters()
getNamedParameters in interface OpenJPAQuery<X>public OpenJPAQuery<X> setParameters(Map params)
setParameters in interface OpenJPAQuery<X>public <T> javax.persistence.Parameter<T> getParameter(String name, Class<T> type)
getParameter in interface javax.persistence.QueryIllegalArgumentException - if the parameter of the
specified name does not exist or is not assignable
to the typeIllegalStateException - if invoked on a native querypublic <T> javax.persistence.Parameter<T> getParameter(int pos,
Class<T> type)
getParameter in interface javax.persistence.QueryIllegalArgumentException - if the parameter with the
specified position does not exist or is not assignable
to the typeIllegalStateException - if invoked on a native query unless
the same parameter position is bound already.public <T> T getParameterValue(javax.persistence.Parameter<T> p)
getParameterValue in interface javax.persistence.Queryparam - parameter objectIllegalStateException - if the parameter has not been been boundIllegalArgumentException - if the parameter does not belong to this querypublic Set<javax.persistence.Parameter<?>> getParameters()
getParameters in interface javax.persistence.Querypublic <T> OpenJPAQuery<X> setParameter(javax.persistence.Parameter<T> p, T arg1)
setParameter in interface javax.persistence.QuerysetParameter in interface javax.persistence.TypedQuery<X>public OpenJPAQuery<X> setParameter(javax.persistence.Parameter<Date> p, Date date, javax.persistence.TemporalType type)
setParameter in interface javax.persistence.QuerysetParameter in interface javax.persistence.TypedQuery<X>public javax.persistence.TypedQuery<X> setParameter(javax.persistence.Parameter<Calendar> p, Calendar cal, javax.persistence.TemporalType type)
setParameter in interface javax.persistence.QuerysetParameter in interface javax.persistence.TypedQuery<X>public javax.persistence.Parameter<?> getParameter(String name)
getParameter in interface javax.persistence.QueryIllegalArgumentException - if the parameter of the specified name does not existIllegalStateException - if invoked on a native querypublic javax.persistence.Parameter<?> getParameter(int pos)
getParameter in interface javax.persistence.Queryposition - specified in the user query.IllegalArgumentException - if the parameter with the given position does not existpublic Object getParameterValue(String name)
getParameterValue in interface javax.persistence.Queryname - name of the parameterIllegalStateException - if this parameter has not been boundpublic Object getParameterValue(int pos)
getParameterValue in interface javax.persistence.Querypos - position of the parameterIllegalStateException - if this parameter has not been boundpublic Set<?> getBoundParameterKeys()
public Set<?> getDeclaredParameterKeys()
public Map<Object,javax.persistence.Parameter<?>> getDeclaredParameters()
public void declareParameter(Object key, javax.persistence.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(javax.persistence.Parameter<?> param)
isBound in interface javax.persistence.Querypublic OpenJPAQuery<X> setParameter(String name, Calendar value, javax.persistence.TemporalType type)
setParameter in interface javax.persistence.QuerysetParameter in interface javax.persistence.TypedQuery<X>setParameter in interface OpenJPAQuery<X>public OpenJPAQuery<X> setParameter(String name, Date value, javax.persistence.TemporalType type)
setParameter in interface javax.persistence.QuerysetParameter in interface javax.persistence.TypedQuery<X>setParameter in interface OpenJPAQuery<X>public OpenJPAQuery<X> setParameter(String name, Object value)
setParameter in interface javax.persistence.QuerysetParameter in interface javax.persistence.TypedQuery<X>setParameter in interface OpenJPAQuery<X>Copyright © 2006-2013 Apache Software Foundation. All Rights Reserved.