Package org.apache.openjpa.kernel
Interface Query
- 
- All Superinterfaces:
 QueryContext,QueryFlushModes,QueryOperations,Serializable
- All Known Implementing Classes:
 DelegatingQuery,DistributedQueryImpl,QueryImpl
public interface Query extends Serializable, QueryContext, QueryOperations, QueryFlushModes
OpenJPA query interface.- Since:
 - 0.3.0
 - Author:
 - Patrick Linskey, Abe White
 
 
- 
- 
Field Summary
- 
Fields inherited from interface org.apache.openjpa.kernel.QueryFlushModes
FLUSH_FALSE, FLUSH_TRUE, FLUSH_WITH_CONNECTION 
- 
Fields inherited from interface org.apache.openjpa.kernel.QueryOperations
OP_DELETE, OP_SELECT, OP_UPDATE 
 - 
 
- 
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddAggregateListener(AggregateListener listener)Register an aggregate listener for the query.voidaddFilterListener(FilterListener listener)Register a filter listener for the query.voidassertNotReadOnly()Assert that the query is not read-only.voidassertNotSerialized()Check that the query has not been serialized, which causes it to lose its association with its Broker.voidassertOpen()Assert that the query's broker is still open.voidcloseAll()Close all open query results.voidcloseResources()Close query results that are consuming resources.voidcompile()Compile the query.longdeleteAll()Deletes all of the instances that are satisfied by the query.longdeleteAll(Object[] parameters)Deletes all of the instances that are satisfied by the query.longdeleteAll(Map<?,?> parameterMap)Deletes all of the instances that are satisfied by the query.Objectexecute()Execute.Objectexecute(Object[] params)Execute with parameter array.Objectexecute(Map<?,?> params)Execute with parameter map.BrokergetBroker()The broker that generated this query.ExtentgetCandidateExtent()Return the candidate extent, ornullif a collection was specified instead of an extent.String[]getDataStoreActions(Map<?,?> params)Returns a description of the commands that will be sent to the datastore in order to execute this query.voidremoveAggregateListener(AggregateListener listener)Remove an aggregate listener from the query.voidremoveFilterListener(FilterListener listener)Remove a filter listener from the query.voidsetCandidateCollection(Collection<?> coll)Set a collection of candidates.voidsetCandidateExtent(Extent extent)Set the candidate extent.voidsetIgnoreChanges(boolean ignore)Whether to ignore changes in the current transaction.booleansetQuery(Object query)The query string or template.longupdateAll()Performs an update of the instances that are satisfied by the query.longupdateAll(Object[] parameters)Performs an update of the instances that are satisfied by the query.longupdateAll(Map<?,?> parameterMap)Performs an update of the instances that are satisfied by the query.- 
Methods inherited from interface org.apache.openjpa.kernel.QueryContext
classForName, declareParameters, deleteInMemory, getAccessPathMetaDatas, getAggregateListener, getAggregateListeners, getAlias, getCandidateCollection, getCandidateType, getCompilation, getEndRange, getFetchConfiguration, getFilterListener, getFilterListeners, getIgnoreChanges, getLanguage, getOperation, getOrderedParameterTypes, getParameterDeclaration, getParameterTypes, getProjectionAliases, getProjectionTypes, getQuery, getQueryString, getResultMappingName, getResultMappingScope, getResultType, getStartRange, getStoreContext, getUpdates, hasGrouping, hasSubclasses, isAggregate, isDistinct, isReadOnly, isUnique, lock, setCandidateType, setRange, setReadOnly, setResultMapping, setResultType, setUnique, unlock, updateInMemory 
 - 
 
 - 
 
- 
- 
Method Detail
- 
getBroker
Broker getBroker()
The broker that generated this query. 
- 
setQuery
boolean setQuery(Object query)
The query string or template. 
- 
setIgnoreChanges
void setIgnoreChanges(boolean ignore)
Whether to ignore changes in the current transaction. 
- 
addFilterListener
void addFilterListener(FilterListener listener)
Register a filter listener for the query. 
- 
removeFilterListener
void removeFilterListener(FilterListener listener)
Remove a filter listener from the query. 
- 
addAggregateListener
void addAggregateListener(AggregateListener listener)
Register an aggregate listener for the query. 
- 
removeAggregateListener
void removeAggregateListener(AggregateListener listener)
Remove an aggregate listener from the query. 
- 
getCandidateExtent
Extent getCandidateExtent()
Return the candidate extent, ornullif a collection was specified instead of an extent. 
- 
setCandidateExtent
void setCandidateExtent(Extent extent)
Set the candidate extent. 
- 
setCandidateCollection
void setCandidateCollection(Collection<?> coll)
Set a collection of candidates. 
- 
compile
void compile()
Compile the query. 
- 
execute
Object execute()
Execute. 
- 
deleteAll
long deleteAll()
Deletes all of the instances that are satisfied by the query.- Returns:
 - the number of instances that were deleted
 
 
- 
deleteAll
long deleteAll(Object[] parameters)
Deletes all of the instances that are satisfied by the query.- Parameters:
 parameters- the positional parameters for the query- Returns:
 - the number of instances that were deleted
 
 
- 
deleteAll
long deleteAll(Map<?,?> parameterMap)
Deletes all of the instances that are satisfied by the query.- Parameters:
 parameterMap- the named parameter map- Returns:
 - the number of instances that were deleted
 
 
- 
updateAll
long updateAll()
Performs an update of the instances that are satisfied by the query.- Returns:
 - the number of instances that were update
 
 
- 
updateAll
long updateAll(Object[] parameters)
Performs an update of the instances that are satisfied by the query.- Parameters:
 parameters- the positional parameter array- Returns:
 - the number of instances that were update
 
 
- 
updateAll
long updateAll(Map<?,?> parameterMap)
Performs an update of the instances that are satisfied by the query.- Parameters:
 parameterMap- the named parameter map- Returns:
 - the number of instances that were update
 
 
- 
closeAll
void closeAll()
Close all open query results. 
- 
closeResources
void closeResources()
Close query results that are consuming resources. Allow results that are not consuming resources to remain open so that they continue to function normally. 
- 
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- Since:
 - 0.3.2
 
 
- 
assertOpen
void assertOpen()
Assert that the query's broker is still open. 
- 
assertNotReadOnly
void assertNotReadOnly()
Assert that the query is not read-only. 
- 
assertNotSerialized
void assertNotSerialized()
Check that the query has not been serialized, which causes it to lose its association with its Broker. 
 - 
 
 -