Package org.apache.openjpa.kernel
Interface QueryContext
- 
- All Known Subinterfaces:
 Query
- All Known Implementing Classes:
 DelegatingQuery,DistributedQueryImpl,QueryImpl
public interface QueryContextA query execution context.- Since:
 - 0.4.0
 - Author:
 - Abe White
 
 
- 
- 
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description 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).voiddeclareParameters(String params)Declared parameters, for query languages that use them.NumberdeleteInMemory(StoreQuery q, StoreQuery.Executor ex, Object[] params)Helper method to delete the objects found by executing a query on the given executor.ClassMetaData[]getAccessPathMetaDatas()Return the classes that affect this query.AggregateListenergetAggregateListener(String tag)Return the filter listener for the given tag, or null.Collection<AggregateListener>getAggregateListeners()The set of aggregate listeners.StringgetAlias()If this query is not a projection but places candidate results into a result class under an alias, return that alias.Collection<?>getCandidateCollection()Return the candidate collection, ornullif an extent was specified instead of a collection.Class<?>getCandidateType()Return the class of the objects that this query will return, ornullif this information is not available / not relevant.ObjectgetCompilation()Return the query's compilation state.longgetEndRange()Return the 0-based exclusive end index for the returned results, orLong.MAX_VALUEfor no limit.FetchConfigurationgetFetchConfiguration()Return the fetch configuration for this query.FilterListenergetFilterListener(String tag)Return the filter listener for the given tag, or null.Collection<FilterListener>getFilterListeners()The set of filter listeners.booleangetIgnoreChanges()Whether to ignore changes in the current transaction.StringgetLanguage()The query language.intgetOperation()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.StringgetParameterDeclaration()The parameter declaration.LinkedMapgetParameterTypes()Deprecated.String[]getProjectionAliases()If this query is a projection, return the projection aliases.Class<?>[]getProjectionTypes()If this query is a projection, return the projection types.QuerygetQuery()Return the query for this context.StringgetQueryString()The query string.StringgetResultMappingName()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 throughsetResultType(java.lang.Class<?>), or null if none.longgetStartRange()Return the 0-based start index for the returned results.StoreContextgetStoreContext()The persistence context for the query.Map<FieldMetaData,Value>getUpdates()If this query is a bulk update, return a map of theFieldMetaDatas toConstants.booleanhasGrouping()Return true if the query uses grouping.booleanhasSubclasses()Whether query results will include subclasses of the candidate class.booleanisAggregate()Return true if the query is an aggregate.booleanisDistinct()Affirms if this query results are distinct instance(s).booleanisReadOnly()Whether the query has been marked read-only.booleanisUnique()The unique flag.voidlock()Synchronize on the query's internal lock.voidsetCandidateType(Class<?> cls, boolean subs)Set the candidate type.voidsetRange(long start, long end)Set the range of results to return.voidsetReadOnly(boolean readOnly)Whether the query has been marked read-only.voidsetResultMapping(Class<?> scope, String name)Name and scope of a mapping from the result data to its object representation.voidsetResultType(Class<?> cls)Specify the type of object in which the result of evaluating this query.voidsetUnique(boolean unique)Specify that the query will return only 1 result, rather than a collection.voidunlock()Unlock the query's internal lock.NumberupdateInMemory(StoreQuery q, StoreQuery.Executor ex, Object[] params)Helper method to update the objects found by executing a query on the given executor. 
 - 
 
- 
- 
Method Detail
- 
getQuery
Query getQuery()
Return the query for this context. Note that the query will be unavailable in remote contexts, and this method may throw an exception to that effect. 
- 
getStoreContext
StoreContext getStoreContext()
The persistence context for the query. 
- 
getFetchConfiguration
FetchConfiguration getFetchConfiguration()
Return the fetch configuration for this query. 
- 
getOperation
int getOperation()
Returns the operation that this query will be expected to perform.- Since:
 - 0.4.0
 - See Also:
 QueryOperations
 
- 
getLanguage
String getLanguage()
The query language. 
- 
getQueryString
String getQueryString()
The query string. 
- 
getCandidateCollection
Collection<?> getCandidateCollection()
Return the candidate collection, ornullif an extent was specified instead of a collection. 
- 
getCandidateType
Class<?> getCandidateType()
Return the class of the objects that this query will return, ornullif this information is not available / not relevant. 
- 
hasSubclasses
boolean hasSubclasses()
Whether query results will include subclasses of the candidate class. 
- 
setCandidateType
void setCandidateType(Class<?> cls, boolean subs)
Set the candidate type. 
- 
isReadOnly
boolean isReadOnly()
Whether the query has been marked read-only. 
- 
setReadOnly
void setReadOnly(boolean readOnly)
Whether the query has been marked read-only. 
- 
isUnique
boolean isUnique()
The unique flag. 
- 
setUnique
void setUnique(boolean unique)
Specify that the query will return only 1 result, rather than a collection. The execute method will return null if the query result size is 0.- Since:
 - 0.3.0
 
 
- 
isDistinct
boolean isDistinct()
Affirms if this query results are distinct instance(s).- Since:
 - 2.0.0
 
 
- 
getResultMappingScope
Class<?> getResultMappingScope()
Scope of a mapping from the result data to its object representation. 
- 
getResultMappingName
String getResultMappingName()
Name of a mapping from the result data to its object representation. 
- 
setResultMapping
void setResultMapping(Class<?> scope, String name)
Name and scope of a mapping from the result data to its object representation. 
- 
getResultType
Class<?> getResultType()
Returns the result class that has been set throughsetResultType(java.lang.Class<?>), or null if none. 
- 
setResultType
void setResultType(Class<?> cls)
Specify the type of object in which the result of evaluating this query.- Since:
 - 0.3.0
 
 
- 
getStartRange
long getStartRange()
Return the 0-based start index for the returned results. 
- 
getEndRange
long getEndRange()
Return the 0-based exclusive end index for the returned results, orLong.MAX_VALUEfor no limit. 
- 
setRange
void setRange(long start, long end)Set the range of results to return.- Parameters:
 start- 0-based inclusive start indexend- 0-based exclusive end index, orLong.MAX_VALUEfor no limit- Since:
 - 0.3.2
 
 
- 
getParameterDeclaration
String getParameterDeclaration()
The parameter declaration. 
- 
declareParameters
void declareParameters(String params)
Declared parameters, for query languages that use them. 
- 
getOrderedParameterTypes
OrderedMap<Object,Class<?>> getOrderedParameterTypes()
Return a map of parameter name to type for this query. The returned map will iterate in the order that the parameters were declared or, if they're implicit, used. 
- 
getParameterTypes
@Deprecated LinkedMap getParameterTypes()
Deprecated.Return a map of parameter name to type for this query. The returned map will iterate in the order that the parameters were declared or, if they're implicit, used. 
- 
getUpdates
Map<FieldMetaData,Value> getUpdates()
If this query is a bulk update, return a map of theFieldMetaDatas toConstants. 
- 
getIgnoreChanges
boolean getIgnoreChanges()
Whether to ignore changes in the current transaction. 
- 
getCompilation
Object getCompilation()
Return the query's compilation state. 
- 
getAlias
String getAlias()
If this query is not a projection but places candidate results into a result class under an alias, return that alias. 
- 
getProjectionAliases
String[] getProjectionAliases()
If this query is a projection, return the projection aliases. 
- 
getProjectionTypes
Class<?>[] getProjectionTypes()
If this query is a projection, return the projection types. 
- 
isAggregate
boolean isAggregate()
Return true if the query is an aggregate. 
- 
hasGrouping
boolean hasGrouping()
Return true if the query uses grouping. 
- 
getAccessPathMetaDatas
ClassMetaData[] getAccessPathMetaDatas()
Return the classes that affect this query. 
- 
getFilterListener
FilterListener getFilterListener(String tag)
Return the filter listener for the given tag, or null. 
- 
getAggregateListener
AggregateListener getAggregateListener(String tag)
Return the filter listener for the given tag, or null. 
- 
getFilterListeners
Collection<FilterListener> getFilterListeners()
The set of filter listeners. 
- 
getAggregateListeners
Collection<AggregateListener> getAggregateListeners()
The set of aggregate listeners. 
- 
deleteInMemory
Number deleteInMemory(StoreQuery q, StoreQuery.Executor ex, Object[] params)
Helper method to delete the objects found by executing a query on the given executor. 
- 
updateInMemory
Number updateInMemory(StoreQuery q, StoreQuery.Executor ex, Object[] params)
Helper method to update the objects found by executing a query on the given executor. 
- 
classForName
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). Returns null if the type cannot be found. 
- 
lock
void lock()
Synchronize on the query's internal lock. 
- 
unlock
void unlock()
Unlock the query's internal lock. 
 - 
 
 -