Package org.apache.openjpa.kernel
Interface StoreQuery.Executor
-
- All Known Implementing Classes:
AbstractStoreQuery.AbstractExecutor
,ExpressionStoreQuery.AbstractExpressionExecutor
,ExpressionStoreQuery.DataStoreExecutor
,ExpressionStoreQuery.InMemoryExecutor
,PreparedSQLStoreQuery.PreparedSQLExecutor
,SQLStoreQuery.SQLExecutor
,StoredProcedureQuery.StoredProcedureQueryExecutor
- Enclosing interface:
- StoreQuery
public static interface StoreQuery.Executor
An executor provides a uniform interface to the mechanism for executing either an in-memory or datastore query. In the common case, theexecuteQuery(org.apache.openjpa.kernel.StoreQuery, java.lang.Object[], org.apache.openjpa.kernel.StoreQuery.Range)
method will be called before other methods, though this is not guaranteed.- Author:
- Marc Prud'hommeaux
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description java.lang.Number
executeDelete(StoreQuery q, java.lang.Object[] params)
Deleted the objects that result from the execution of the query, retuning the number of objects that were deleted.ResultObjectProvider
executeQuery(StoreQuery q, java.lang.Object[] params, StoreQuery.Range range)
Return the result of executing this query with the given parameter values.java.lang.Number
executeUpdate(StoreQuery q, java.lang.Object[] params)
Updates the objects that result from the execution of the query, retuning the number of objects that were updated.ClassMetaData[]
getAccessPathMetaDatas(StoreQuery q)
Return an array of all persistent classes used in this query, or empty array if unknown.java.lang.String
getAlias(StoreQuery q)
If this is not a projection but the candidate results are placed into a result class with an alias, return that alias.boolean[]
getAscending(StoreQuery q)
Return the ordering direction for all ordering clauses, or empty array if none.java.lang.String[]
getDataStoreActions(StoreQuery q, java.lang.Object[] params, StoreQuery.Range range)
Return a description of the commands that will be sent to the datastore in order to execute the query.int
getOperation(StoreQuery q)
Returns the operation this executor is meant to execute.OrderedMap<java.lang.Object,java.lang.Class<?>>
getOrderedParameterTypes(StoreQuery q)
Return a map of parameter names to types.java.lang.Object
getOrderingValue(StoreQuery q, java.lang.Object[] params, java.lang.Object resultObject, int orderIndex)
Extract the value of theorderIndex
th ordering expression inQuery#getOrderingClauses
from the given result object.LinkedMap
getParameterTypes(StoreQuery q)
Deprecated.java.lang.String[]
getProjectionAliases(StoreQuery q)
Return the alias for each projection element, or empty array if not a projection.java.lang.Class<?>[]
getProjectionTypes(StoreQuery q)
Return the expected types of the projections used by this query, or an empty array if not a projection.QueryExpressions[]
getQueryExpressions()
Return the parsed query expressions for our candidate types.void
getRange(StoreQuery q, java.lang.Object[] params, StoreQuery.Range range)
Mutate the given range to set any range information stored in the query string and/or parameters.java.lang.Class<?>
getResultClass(StoreQuery q)
Returns the result class, if any.ResultShape<?>
getResultShape(StoreQuery q)
java.util.Map<FieldMetaData,Value>
getUpdates(StoreQuery q)
Return a map ofFieldMetaData
to updateConstant
s, in cases where this query is for a bulk update.boolean
hasGrouping(StoreQuery q)
Whether the compiled query has grouping.boolean
isAggregate(StoreQuery q)
Return true if the compiled query is an aggregate.boolean
isDistinct(StoreQuery q)
boolean
isPacking(StoreQuery q)
Return true if this executor packs projections into the result class itself.java.lang.Object[]
toParameterArray(StoreQuery q, java.util.Map<?,?> userParams)
Return an array from the given user parameter values.void
validate(StoreQuery q)
Validate components of query.
-
-
-
Method Detail
-
executeQuery
ResultObjectProvider executeQuery(StoreQuery q, java.lang.Object[] params, StoreQuery.Range range)
Return the result of executing this query with the given parameter values. If this query is a projection and this executor does not pack results itself, each element of the returned result object provider should be an object array containing the projection values.- Parameters:
lrs
- true if the query result should be treated as a large result set, assuming the query is not an aggregate and does not have grouping- See Also:
isPacking(org.apache.openjpa.kernel.StoreQuery)
-
executeDelete
java.lang.Number executeDelete(StoreQuery q, java.lang.Object[] params)
Deleted the objects that result from the execution of the query, retuning the number of objects that were deleted.
-
executeUpdate
java.lang.Number executeUpdate(StoreQuery q, java.lang.Object[] params)
Updates the objects that result from the execution of the query, retuning the number of objects that were updated.
-
getDataStoreActions
java.lang.String[] getDataStoreActions(StoreQuery q, java.lang.Object[] params, StoreQuery.Range range)
Return a description of the commands that will be sent to the datastore in order to execute the query.
-
validate
void validate(StoreQuery q)
Validate components of query.
-
getRange
void getRange(StoreQuery q, java.lang.Object[] params, StoreQuery.Range range)
Mutate the given range to set any range information stored in the query string and/or parameters.
-
getOrderingValue
java.lang.Object getOrderingValue(StoreQuery q, java.lang.Object[] params, java.lang.Object resultObject, int orderIndex)
Extract the value of theorderIndex
th ordering expression inQuery#getOrderingClauses
from the given result object. The result object will be an object from the result object provider returned fromexecuteQuery(org.apache.openjpa.kernel.StoreQuery, java.lang.Object[], org.apache.openjpa.kernel.StoreQuery.Range)
. This method is used when several result lists have to be merged in memory. If this exeuctor's parent query supports executors on abstract or interface classes, this method will not be used.- See Also:
StoreQuery.supportsAbstractExecutors()
-
getAscending
boolean[] getAscending(StoreQuery q)
Return the ordering direction for all ordering clauses, or empty array if none.
-
isPacking
boolean isPacking(StoreQuery q)
Return true if this executor packs projections into the result class itself. Executors for query languages that allow projections without result clauses must return true and perform the result packing themselves.
-
getAlias
java.lang.String getAlias(StoreQuery q)
If this is not a projection but the candidate results are placed into a result class with an alias, return that alias.
-
getProjectionAliases
java.lang.String[] getProjectionAliases(StoreQuery q)
Return the alias for each projection element, or empty array if not a projection.
-
getProjectionTypes
java.lang.Class<?>[] getProjectionTypes(StoreQuery q)
Return the expected types of the projections used by this query, or an empty array if not a projection.
-
getAccessPathMetaDatas
ClassMetaData[] getAccessPathMetaDatas(StoreQuery q)
Return an array of all persistent classes used in this query, or empty array if unknown.
-
getOperation
int getOperation(StoreQuery q)
Returns the operation this executor is meant to execute.- See Also:
QueryOperations
-
isAggregate
boolean isAggregate(StoreQuery q)
Return true if the compiled query is an aggregate.
-
isDistinct
boolean isDistinct(StoreQuery q)
-
hasGrouping
boolean hasGrouping(StoreQuery q)
Whether the compiled query has grouping.
-
getOrderedParameterTypes
OrderedMap<java.lang.Object,java.lang.Class<?>> getOrderedParameterTypes(StoreQuery q)
Return a map of parameter names to types. The returnedMap.entrySet()
'sIterator
must return values in the order in which they were declared or used.
-
getParameterTypes
@Deprecated LinkedMap getParameterTypes(StoreQuery q)
Deprecated.Return a map of parameter names to types. The returnedMap.entrySet()
'sIterator
must return values in the order in which they were declared or used.
Warning: Deprecated. Use getOrderedParameterTypes(StoreQuery) instead.
-
toParameterArray
java.lang.Object[] toParameterArray(StoreQuery q, java.util.Map<?,?> userParams)
Return an array from the given user parameter values. The array ordering is same as what this executor expects for its executeXXX() methods as its Object[] parameters. If the given userParams is null or empty return an empty array rather than null.- Returns:
- array with parameter values ordered in the same way as this receiver's executeXXX() method expects.
- Since:
- 2.0.0
-
getResultClass
java.lang.Class<?> getResultClass(StoreQuery q)
Returns the result class, if any.
-
getResultShape
ResultShape<?> getResultShape(StoreQuery q)
-
getUpdates
java.util.Map<FieldMetaData,Value> getUpdates(StoreQuery q)
Return a map ofFieldMetaData
to updateConstant
s, in cases where this query is for a bulk update.
-
getQueryExpressions
QueryExpressions[] getQueryExpressions()
Return the parsed query expressions for our candidate types. The expressions are available only after query has been parsed.- Since:
- 2.0.0
-
-