public abstract class AbstractQuery<X> extends Object implements OpenJPAQuerySPI<X>
| Modifier and Type | Field and Description |
|---|---|
protected Map<javax.persistence.Parameter<?>,Object> |
_boundParams |
protected boolean |
_convertPositionalParams |
protected Map<Object,javax.persistence.Parameter<?>> |
_declaredParams |
protected EntityManagerImpl |
_em |
protected QueryMetaData |
_qmd |
protected boolean |
_relaxBindParameterTypeChecking |
FLUSH_FALSE, FLUSH_TRUE, FLUSH_WITH_CONNECTION, HINT_RESULT_COUNT, OP_DELETE, OP_SELECT, OP_UPDATE| Constructor and Description |
|---|
AbstractQuery(QueryMetaData qmd,
EntityManagerImpl em) |
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
assertOpen() |
void |
declareParameter(Object key,
javax.persistence.Parameter<?> param)
Declares the given parameter for this query.
|
Set<?> |
getBoundParameterKeys()
Gets the parameter keys bound with 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.
|
Map<String,Object> |
getNamedParameters()
Gets the value of all the named parameters.
|
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.
|
protected abstract OrderedMap<Object,Class<?>> |
getParamTypes() |
Object[] |
getPositionalParameters()
Gets the array of positional parameter values.
|
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.
|
boolean |
hasPositionalParameters()
Affirms if declared parameters use position identifier.
|
boolean |
isBound(javax.persistence.Parameter<?> param)
Affirms if the given parameter is bound to a value for this query.
|
boolean |
isNative() |
boolean |
isProcedure() |
protected abstract void |
lock() |
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.
|
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.
|
protected abstract void |
unlock() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddAggregateListener, addFilterListener, removeAggregateListener, removeFilterListenercloseAll, compile, getCandidateCollection, getDataStoreActions, getEntityManager, getFetchPlan, getFirstResult, getFlushMode, getIgnoreChanges, getLanguage, getMaxResults, getOperation, getQueryString, getResultClass, getSupportedHints, hasSubclasses, setCandidateCollection, setFirstResult, setFlushMode, setHint, setIgnoreChanges, setMaxResults, setResultClass, setSubclassesprotected boolean _relaxBindParameterTypeChecking
protected boolean _convertPositionalParams
protected final QueryMetaData _qmd
protected transient EntityManagerImpl _em
public AbstractQuery(QueryMetaData qmd, EntityManagerImpl em)
public boolean isProcedure()
public boolean isNative()
protected abstract void assertOpen()
protected abstract void lock()
protected abstract void unlock()
protected abstract OrderedMap<Object,Class<?>> getParamTypes()
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>public boolean getRelaxBindParameterTypeChecking()
OpenJPAQuerygetRelaxBindParameterTypeChecking 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)Copyright © 2006–2020 Apache Software Foundation. All rights reserved.