public class DelegatingQuery extends Object implements Query
OP_DELETE, OP_SELECT, OP_UPDATEFLUSH_FALSE, FLUSH_TRUE, FLUSH_WITH_CONNECTION| Constructor and Description |
|---|
DelegatingQuery(Query query)
Constructor; supply delegate.
|
DelegatingQuery(Query query,
RuntimeExceptionTranslator trans)
Constructor; supply delegate and exception translator.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAggregateListener(AggregateListener listener)
Register an aggregate listener for the query.
|
void |
addFilterListener(FilterListener listener)
Register a filter listener for the query.
|
void |
assertNotReadOnly()
Assert that the query is not read-only.
|
void |
assertNotSerialized()
Check that the query has not been serialized, which causes it to lose
its association with its Broker.
|
void |
assertOpen()
Assert that the query's broker is still open.
|
Class |
classForName(String name,
String[] imports)
Helper method to instantiate the class with the given name, taking
into account the query's candidate package, automatic imports, and
the given imports (if any).
|
void |
closeAll()
Close all open query results.
|
void |
closeResources()
Close query results that are consuming resources.
|
void |
compile()
Compile the query.
|
void |
declareParameters(String params)
Declared parameters, for query languages that use them.
|
long |
deleteAll()
Deletes all of the instances that are satisfied by the query.
|
long |
deleteAll(Map parameterMap)
Deletes all of the instances that are satisfied by the query.
|
long |
deleteAll(Object[] parameters)
Deletes all of the instances that are satisfied by the query.
|
Number |
deleteInMemory(StoreQuery q,
StoreQuery.Executor ex,
Object[] params)
Helper method to delete the objects found by executing a query on
the given executor.
|
boolean |
equals(Object other) |
Object |
execute()
Execute.
|
Object |
execute(Map params)
Execute with parameter map.
|
Object |
execute(Object[] params)
Execute with parameter array.
|
ClassMetaData[] |
getAccessPathMetaDatas()
Return the classes that affect this query.
|
AggregateListener |
getAggregateListener(String tag)
Return the filter listener for the given tag, or null.
|
Collection |
getAggregateListeners()
The set of aggregate listeners.
|
String |
getAlias()
If this query is not a projection but places candidate results into a
result class under an alias, return that alias.
|
Broker |
getBroker()
The broker that generated this query.
|
Collection |
getCandidateCollection()
Return the candidate collection, or
null if an
extent was specified instead of a collection. |
Extent |
getCandidateExtent()
Return the candidate extent, or
null if a
collection was specified instead of an extent. |
Class |
getCandidateType()
Return the class of the objects that this query will return,
or
null if this information is not available / not relevant. |
Object |
getCompilation()
Return the query's compilation state.
|
String[] |
getDataStoreActions(Map params)
Returns a description of the commands that will be sent to
the datastore in order to execute this query.
|
Query |
getDelegate()
Return the direct delegate.
|
long |
getEndRange()
Return the 0-based exclusive end index for the returned results,
or
Long.MAX_VALUE for no limit. |
FetchConfiguration |
getFetchConfiguration()
Return the fetch configuration for this query.
|
FilterListener |
getFilterListener(String tag)
Return the filter listener for the given tag, or null.
|
Collection |
getFilterListeners()
The set of filter listeners.
|
boolean |
getIgnoreChanges()
Whether to ignore changes in the current transaction.
|
Query |
getInnermostDelegate()
Return the native delegate.
|
String |
getLanguage()
The query language.
|
int |
getOperation()
Returns the operation that this query will be expected to perform.
|
OrderedMap<Object,Class<?>> |
getOrderedParameterTypes()
Return a map of parameter name to type for this query.
|
String |
getParameterDeclaration()
The parameter declaration.
|
LinkedMap |
getParameterTypes()
Return a map of parameter name to type for this query.
|
String[] |
getProjectionAliases()
If this query is a projection, return the projection aliases.
|
Class[] |
getProjectionTypes()
If this query is a projection, return the projection types.
|
Query |
getQuery()
Return the query for this context.
|
String |
getQueryString()
The query string.
|
String |
getResultMappingName()
Name of a mapping from the result data to its object representation.
|
Class |
getResultMappingScope()
Scope of a mapping from the result data to its object representation.
|
Class |
getResultType()
Returns the result class that has been set through
QueryContext.setResultType(java.lang.Class<?>), or null if none. |
long |
getStartRange()
Return the 0-based start index for the returned results.
|
StoreContext |
getStoreContext()
The persistence context for the query.
|
Map |
getUpdates()
If this query is a bulk update, return a map of the
FieldMetaDatas to Constants. |
boolean |
hasGrouping()
Return true if the query uses grouping.
|
int |
hashCode() |
boolean |
hasSubclasses()
Whether query results will include subclasses of the candidate class.
|
boolean |
isAggregate()
Return true if the query is an aggregate.
|
boolean |
isDistinct()
Affirms if this query results are distinct instance(s).
|
boolean |
isReadOnly()
Whether the query has been marked read-only.
|
boolean |
isUnique()
The unique flag.
|
void |
lock()
Synchronize on the query's internal lock.
|
void |
removeAggregateListener(AggregateListener listener)
Remove an aggregate listener from the query.
|
void |
removeFilterListener(FilterListener listener)
Remove a filter listener from the query.
|
void |
setCandidateCollection(Collection coll)
Set a collection of candidates.
|
void |
setCandidateExtent(Extent extent)
Set the candidate extent.
|
void |
setCandidateType(Class cls,
boolean subs)
Set the candidate type.
|
void |
setIgnoreChanges(boolean ignore)
Whether to ignore changes in the current transaction.
|
boolean |
setQuery(Object query)
The query string or template.
|
void |
setRange(long start,
long end)
Set the range of results to return.
|
void |
setReadOnly(boolean readOnly)
Whether the query has been marked read-only.
|
void |
setResultMapping(Class scope,
String name)
Name and scope of a mapping from the result data to its object
representation.
|
void |
setResultType(Class cls)
Specify the type of object in which the result of evaluating this query.
|
void |
setUnique(boolean unique)
Specify that the query will return only 1
result, rather than a collection.
|
protected RuntimeException |
translate(RuntimeException re)
Translate the OpenJPA exception.
|
void |
unlock()
Unlock the query's internal lock.
|
long |
updateAll()
Performs an update of the instances that are satisfied by the query.
|
long |
updateAll(Map parameterMap)
Performs an update of the instances that are satisfied by the query.
|
long |
updateAll(Object[] parameters)
Performs an update of the instances that are satisfied by the query.
|
Number |
updateInMemory(StoreQuery q,
StoreQuery.Executor ex,
Object[] params)
Helper method to update the objects found by executing a query on
the given executor.
|
public DelegatingQuery(Query query)
public DelegatingQuery(Query query, RuntimeExceptionTranslator trans)
public Query getDelegate()
public Query getInnermostDelegate()
protected RuntimeException translate(RuntimeException re)
public Broker getBroker()
Querypublic Query getQuery()
QueryContextgetQuery in interface QueryContextpublic StoreContext getStoreContext()
QueryContextgetStoreContext in interface QueryContextpublic int getOperation()
QueryContextgetOperation in interface QueryContextQueryOperationspublic String getLanguage()
QueryContextgetLanguage in interface QueryContextpublic FetchConfiguration getFetchConfiguration()
QueryContextgetFetchConfiguration in interface QueryContextpublic String getQueryString()
QueryContextgetQueryString in interface QueryContextpublic boolean getIgnoreChanges()
QueryContextgetIgnoreChanges in interface QueryContextpublic Object getCompilation()
QueryContextgetCompilation in interface QueryContextpublic String getAlias()
QueryContextgetAlias in interface QueryContextpublic String[] getProjectionAliases()
QueryContextgetProjectionAliases in interface QueryContextpublic Class[] getProjectionTypes()
QueryContextgetProjectionTypes in interface QueryContextpublic boolean isAggregate()
QueryContextisAggregate in interface QueryContextpublic boolean hasGrouping()
QueryContexthasGrouping in interface QueryContextpublic ClassMetaData[] getAccessPathMetaDatas()
QueryContextgetAccessPathMetaDatas in interface QueryContextpublic FilterListener getFilterListener(String tag)
QueryContextgetFilterListener in interface QueryContextpublic AggregateListener getAggregateListener(String tag)
QueryContextgetAggregateListener in interface QueryContextpublic Collection getFilterListeners()
QueryContextgetFilterListeners in interface QueryContextpublic Collection getAggregateListeners()
QueryContextgetAggregateListeners in interface QueryContextpublic Collection getCandidateCollection()
QueryContextnull if an
extent was specified instead of a collection.getCandidateCollection in interface QueryContextpublic Class getCandidateType()
QueryContextnull if this information is not available / not relevant.getCandidateType in interface QueryContextpublic boolean hasSubclasses()
QueryContexthasSubclasses in interface QueryContextpublic void setCandidateType(Class cls, boolean subs)
QueryContextsetCandidateType in interface QueryContextpublic boolean isReadOnly()
QueryContextisReadOnly in interface QueryContextpublic void setReadOnly(boolean readOnly)
QueryContextsetReadOnly in interface QueryContextpublic Class getResultMappingScope()
QueryContextgetResultMappingScope in interface QueryContextpublic String getResultMappingName()
QueryContextgetResultMappingName in interface QueryContextpublic void setResultMapping(Class scope, String name)
QueryContextsetResultMapping in interface QueryContextpublic boolean isUnique()
QueryContextisUnique in interface QueryContextpublic void setUnique(boolean unique)
QueryContextsetUnique in interface QueryContextpublic boolean isDistinct()
QueryContextisDistinct in interface QueryContextpublic Class getResultType()
QueryContextQueryContext.setResultType(java.lang.Class<?>), or null if none.getResultType in interface QueryContextpublic void setResultType(Class cls)
QueryContextsetResultType in interface QueryContextpublic long getStartRange()
QueryContextgetStartRange in interface QueryContextpublic long getEndRange()
QueryContextLong.MAX_VALUE for no limit.getEndRange in interface QueryContextpublic void setRange(long start,
long end)
QueryContextsetRange in interface QueryContextstart - 0-based inclusive start indexend - 0-based exclusive end index, or
Long.MAX_VALUE for no limitpublic String getParameterDeclaration()
QueryContextgetParameterDeclaration in interface QueryContextpublic OrderedMap<Object,Class<?>> getOrderedParameterTypes()
QueryContextgetOrderedParameterTypes in interface QueryContextpublic LinkedMap getParameterTypes()
QueryContextgetParameterTypes in interface QueryContextpublic Map getUpdates()
QueryContextFieldMetaDatas to Constants.getUpdates in interface QueryContextpublic void declareParameters(String params)
QueryContextdeclareParameters in interface QueryContextpublic Number deleteInMemory(StoreQuery q, StoreQuery.Executor ex, Object[] params)
QueryContextdeleteInMemory in interface QueryContextpublic Number updateInMemory(StoreQuery q, StoreQuery.Executor ex, Object[] params)
QueryContextupdateInMemory in interface QueryContextpublic Class classForName(String name, String[] imports)
QueryContextclassForName in interface QueryContextpublic void lock()
QueryContextlock in interface QueryContextpublic void unlock()
QueryContextunlock in interface QueryContextpublic void addFilterListener(FilterListener listener)
QueryaddFilterListener in interface Querypublic void removeFilterListener(FilterListener listener)
QueryremoveFilterListener in interface Querypublic void addAggregateListener(AggregateListener listener)
QueryaddAggregateListener in interface Querypublic void removeAggregateListener(AggregateListener listener)
QueryremoveAggregateListener in interface Querypublic Extent getCandidateExtent()
Querynull if a
collection was specified instead of an extent.getCandidateExtent in interface Querypublic void setCandidateExtent(Extent extent)
QuerysetCandidateExtent in interface Querypublic void setCandidateCollection(Collection coll)
QuerysetCandidateCollection in interface Querypublic void compile()
Querypublic Object execute(Map params)
Querypublic Object execute(Object[] params)
Querypublic long deleteAll()
Querypublic long deleteAll(Object[] parameters)
Querypublic long deleteAll(Map parameterMap)
Querypublic long updateAll()
Querypublic long updateAll(Object[] parameters)
Querypublic long updateAll(Map parameterMap)
Querypublic void closeAll()
Querypublic void closeResources()
QuerycloseResources in interface Querypublic String[] getDataStoreActions(Map params)
QuerygetDataStoreActions in interface Queryparams - the named parameter map for the query invocationpublic boolean setQuery(Object query)
Querypublic void setIgnoreChanges(boolean ignore)
QuerysetIgnoreChanges in interface Querypublic void assertOpen()
QueryassertOpen in interface Querypublic void assertNotReadOnly()
QueryassertNotReadOnly in interface Querypublic void assertNotSerialized()
QueryassertNotSerialized in interface QueryCopyright © 2006–2022 Apache Software Foundation. All rights reserved.