Package org.apache.openjpa.jdbc.kernel
Class JDBCStoreQuery
java.lang.Object
org.apache.openjpa.kernel.AbstractStoreQuery
org.apache.openjpa.kernel.ExpressionStoreQuery
org.apache.openjpa.jdbc.kernel.JDBCStoreQuery
- All Implemented Interfaces:
Serializable,QueryOperations,StoreQuery
JDBC query implementation.
- Author:
- Abe White
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.openjpa.kernel.ExpressionStoreQuery
ExpressionStoreQuery.AbstractExpressionExecutor, ExpressionStoreQuery.DataStoreExecutor, ExpressionStoreQuery.InMemoryExecutorNested classes/interfaces inherited from class org.apache.openjpa.kernel.AbstractStoreQuery
AbstractStoreQuery.AbstractExecutorNested classes/interfaces inherited from interface org.apache.openjpa.kernel.StoreQuery
StoreQuery.Executor, StoreQuery.Range -
Field Summary
Fields inherited from class org.apache.openjpa.kernel.ExpressionStoreQuery
_parsed, _parserFields inherited from class org.apache.openjpa.kernel.AbstractStoreQuery
ctxFields inherited from interface org.apache.openjpa.kernel.QueryOperations
OP_DELETE, OP_SELECT, OP_UPDATEFields inherited from interface org.apache.openjpa.kernel.StoreQuery
EMPTY_BOOLEANS, EMPTY_CLASSES, EMPTY_METAS, EMPTY_OBJECTS, EMPTY_ORDERED_PARAMS, EMPTY_PARAMS, EMPTY_STRINGS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionevaluate(Object value, Object ob, Object[] params, OpenJPAStateManager sm) protected NumberexecuteDelete(StoreQuery.Executor ex, ClassMetaData base, ClassMetaData[] metas, boolean subclasses, ExpressionFactory[] facts, QueryExpressions[] exps, Object[] params) Execute the given expression against the given candidate extent and delete the instances.protected ResultObjectProviderexecuteQuery(StoreQuery.Executor ex, ClassMetaData base, ClassMetaData[] metas, boolean subclasses, ExpressionFactory[] facts, QueryExpressions[] exps, Object[] params, StoreQuery.Range range) Execute the given expression against the given candidate extent.protected intexecuteUpdate(Connection conn, PreparedStatement stmnt, SQLBuffer sqlBuf, boolean isUpdate) This method is to provide override for non-JDBC or JDBC-like implementation of executing update.protected NumberexecuteUpdate(StoreQuery.Executor ex, ClassMetaData base, ClassMetaData[] metas, boolean subclasses, ExpressionFactory[] facts, QueryExpressions[] exps, Object[] params) Execute the given expression against the given candidate extent and updates the instances.protected NumberexecuteUpdate(ClassMetaData base, ClassMetaData[] metas, boolean subclasses, ExpressionFactory[] facts, QueryExpressions[] parsed, Object[] params) protected String[]getDataStoreActions(ClassMetaData base, ClassMetaData[] metas, boolean subclasses, ExpressionFactory[] facts, QueryExpressions[] exps, Object[] params, StoreQuery.Range range) Return the commands that will be sent to the datastore in order to execute the query, typically in the database's native language.protected ExpressionFactoryReturn anExpressionFactoryto use to create an expression to be executed against an extent.getFilterListener(String tag) Return the standard filter listener for the given tag, or null.protected ClassMetaData[]getIndependentExpressionCandidates(ClassMetaData meta, boolean subclasses) Return the assignable types for the given metadata whose expression trees must be compiled independently.getStore()Return the store.static Context[]static ContextgetThreadLocalContext(Context orig) static ContextgetThreadLocalContext(Context lctx, Context cloneFrom) static SelectgetThreadLocalSelect(Select select) Create a new key for caching compiled query information.protected PreparedStatementprepareStatement(Connection conn, SQLBuffer sql) This method is to provide override for non-JDBC or JDBC-like implementation of preparing statement.booleanTrue if this query supports datastore execution, false if it can only run in memory.Methods inherited from class org.apache.openjpa.kernel.ExpressionStoreQuery
getCompilation, getResolver, invalidateCompilation, newCompilation, newDataStoreExecutor, newInMemoryExecutor, populateFromCompilation, setQuery, supportsInMemoryExecutionMethods inherited from class org.apache.openjpa.kernel.AbstractStoreQuery
getAggregateListener, getContext, requiresCandidateType, requiresParameterDeclarations, setContext, supportsAbstractExecutors, supportsParameterDeclarations
-
Constructor Details
-
JDBCStoreQuery
Constructor. Supply store manager.
-
-
Method Details
-
getStore
Return the store. -
getFilterListener
Description copied from interface:StoreQueryReturn the standard filter listener for the given tag, or null.- Specified by:
getFilterListenerin interfaceStoreQuery- Overrides:
getFilterListenerin classExpressionStoreQuery
-
newCompilationKey
Description copied from interface:StoreQueryCreate a new key for caching compiled query information. May be null.- Specified by:
newCompilationKeyin interfaceStoreQuery- Overrides:
newCompilationKeyin classAbstractStoreQuery
-
supportsDataStoreExecution
public boolean supportsDataStoreExecution()Description copied from interface:StoreQueryTrue if this query supports datastore execution, false if it can only run in memory.- Specified by:
supportsDataStoreExecutionin interfaceStoreQuery- Overrides:
supportsDataStoreExecutionin classAbstractStoreQuery
-
getIndependentExpressionCandidates
protected ClassMetaData[] getIndependentExpressionCandidates(ClassMetaData meta, boolean subclasses) Description copied from class:ExpressionStoreQueryReturn the assignable types for the given metadata whose expression trees must be compiled independently.- Overrides:
getIndependentExpressionCandidatesin classExpressionStoreQuery
-
getExpressionFactory
Description copied from class:ExpressionStoreQueryReturn anExpressionFactoryto use to create an expression to be executed against an extent. Each factory will be used to compile one filter only. The factory must be cachable.- Overrides:
getExpressionFactoryin classExpressionStoreQuery
-
executeQuery
protected ResultObjectProvider executeQuery(StoreQuery.Executor ex, ClassMetaData base, ClassMetaData[] metas, boolean subclasses, ExpressionFactory[] facts, QueryExpressions[] exps, Object[] params, StoreQuery.Range range) Description copied from class:ExpressionStoreQueryExecute the given expression against the given candidate extent.- Overrides:
executeQueryin classExpressionStoreQuery- Parameters:
ex- current executorbase- the base type the query should matchmetas- the independent candidate typessubclasses- true if subclasses should be included in the resultsfacts- the expression factory used to build the query for each base typeexps- the parsed query valuesparams- parameter values, or empty arrayrange- result range- Returns:
- a provider for matching objects
-
executeDelete
protected Number executeDelete(StoreQuery.Executor ex, ClassMetaData base, ClassMetaData[] metas, boolean subclasses, ExpressionFactory[] facts, QueryExpressions[] exps, Object[] params) Description copied from class:ExpressionStoreQueryExecute the given expression against the given candidate extent and delete the instances.- Overrides:
executeDeletein classExpressionStoreQuery- Parameters:
ex- current executorbase- the base type the query should matchmetas- the independent candidate typessubclasses- true if subclasses should be included in the resultsfacts- the expression factory used to build the query for each base typeexps- the parsed query valuesparams- parameter values, or empty array- Returns:
- a number indicating the number of instances deleted, or null to execute the delete in memory
-
executeUpdate
protected Number executeUpdate(StoreQuery.Executor ex, ClassMetaData base, ClassMetaData[] metas, boolean subclasses, ExpressionFactory[] facts, QueryExpressions[] exps, Object[] params) Description copied from class:ExpressionStoreQueryExecute the given expression against the given candidate extent and updates the instances.- Overrides:
executeUpdatein classExpressionStoreQuery- Parameters:
ex- current executorbase- the base type the query should matchmetas- the independent candidate typessubclasses- true if subclasses should be included in the resultsfacts- the expression factory used to build the query for each base typeexps- the parsed query valuesparams- parameter values, or empty array- Returns:
- a number indicating the number of instances updated, or null to execute the update in memory.
-
executeUpdate
protected Number executeUpdate(ClassMetaData base, ClassMetaData[] metas, boolean subclasses, ExpressionFactory[] facts, QueryExpressions[] parsed, Object[] params) -
getDataStoreActions
protected String[] getDataStoreActions(ClassMetaData base, ClassMetaData[] metas, boolean subclasses, ExpressionFactory[] facts, QueryExpressions[] exps, Object[] params, StoreQuery.Range range) Description copied from class:ExpressionStoreQueryReturn the commands that will be sent to the datastore in order to execute the query, typically in the database's native language.- Overrides:
getDataStoreActionsin classExpressionStoreQuery- Parameters:
base- the base type the query should matchmetas- the independent candidate typessubclasses- true if subclasses should be included in the resultsfacts- the expression factory used to build the query for each base typeexps- the parsed query valuesparams- parameter values, or empty arrayrange- result range- Returns:
- a textual description of the query to execute
-
executeUpdate
protected int executeUpdate(Connection conn, PreparedStatement stmnt, SQLBuffer sqlBuf, boolean isUpdate) throws SQLException This method is to provide override for non-JDBC or JDBC-like implementation of executing update.- Throws:
SQLException
-
prepareStatement
This method is to provide override for non-JDBC or JDBC-like implementation of preparing statement.- Throws:
SQLException
-
evaluate
- Specified by:
evaluatein interfaceStoreQuery- Overrides:
evaluatein classAbstractStoreQuery
-
getThreadLocalContext
-
getThreadLocalContext
-
getThreadLocalSelect
-
getThreadLocalContext
-