org.apache.openjpa.jdbc.kernel
Class JDBCStoreQuery

java.lang.Object
  extended by org.apache.openjpa.kernel.AbstractStoreQuery
      extended by org.apache.openjpa.kernel.ExpressionStoreQuery
          extended by org.apache.openjpa.jdbc.kernel.JDBCStoreQuery
All Implemented Interfaces:
Serializable, QueryOperations, StoreQuery

public class JDBCStoreQuery
extends ExpressionStoreQuery

JDBC query implementation.

Author:
Abe White
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.openjpa.kernel.AbstractStoreQuery
AbstractStoreQuery.AbstractExecutor
 
Nested classes/interfaces inherited from interface org.apache.openjpa.kernel.StoreQuery
StoreQuery.Executor, StoreQuery.Range
 
Field Summary
 
Fields inherited from class org.apache.openjpa.kernel.AbstractStoreQuery
ctx
 
Fields inherited from interface org.apache.openjpa.kernel.StoreQuery
EMPTY_BOOLEANS, EMPTY_CLASSES, EMPTY_METAS, EMPTY_OBJECTS, EMPTY_PARAMS, EMPTY_STRINGS
 
Fields inherited from interface org.apache.openjpa.kernel.QueryOperations
OP_DELETE, OP_SELECT, OP_UPDATE
 
Constructor Summary
JDBCStoreQuery(JDBCStore store, ExpressionParser parser)
          Constructor.
 
Method Summary
protected  Number executeDelete(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  ResultObjectProvider executeQuery(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  Number executeUpdate(ClassMetaData base, ClassMetaData[] metas, boolean subclasses, ExpressionFactory[] facts, QueryExpressions[] parsed, Object[] params)
           
protected  Number executeUpdate(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  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  ExpressionFactory getExpressionFactory(ClassMetaData meta)
          Return an ExpressionFactory to use to create an expression to be executed against an extent.
 FilterListener 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.
 JDBCStore getStore()
          Return the store.
 Object newCompilationKey()
          Create a new key for caching compiled query information.
 boolean supportsDataStoreExecution()
          True if this query supports datastore execution, false if it can only run in memory.
 
Methods inherited from class org.apache.openjpa.kernel.ExpressionStoreQuery
getResolver, invalidateCompilation, newCompilation, newDataStoreExecutor, newInMemoryExecutor, populateFromCompilation, setQuery, supportsInMemoryExecution
 
Methods inherited from class org.apache.openjpa.kernel.AbstractStoreQuery
getAggregateListener, getContext, requiresCandidateType, requiresParameterDeclarations, setContext, supportsAbstractExecutors, supportsParameterDeclarations
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JDBCStoreQuery

public JDBCStoreQuery(JDBCStore store,
                      ExpressionParser parser)
Constructor. Supply store manager.

Method Detail

getStore

public JDBCStore getStore()
Return the store.


getFilterListener

public FilterListener getFilterListener(String tag)
Description copied from interface: StoreQuery
Return the standard filter listener for the given tag, or null.

Specified by:
getFilterListener in interface StoreQuery
Overrides:
getFilterListener in class ExpressionStoreQuery

newCompilationKey

public Object newCompilationKey()
Description copied from interface: StoreQuery
Create a new key for caching compiled query information. May be null.

Specified by:
newCompilationKey in interface StoreQuery
Overrides:
newCompilationKey in class AbstractStoreQuery

supportsDataStoreExecution

public boolean supportsDataStoreExecution()
Description copied from interface: StoreQuery
True if this query supports datastore execution, false if it can only run in memory.

Specified by:
supportsDataStoreExecution in interface StoreQuery
Overrides:
supportsDataStoreExecution in class AbstractStoreQuery

getIndependentExpressionCandidates

protected ClassMetaData[] getIndependentExpressionCandidates(ClassMetaData meta,
                                                             boolean subclasses)
Description copied from class: ExpressionStoreQuery
Return the assignable types for the given metadata whose expression trees must be compiled independently.

Overrides:
getIndependentExpressionCandidates in class ExpressionStoreQuery

getExpressionFactory

protected ExpressionFactory getExpressionFactory(ClassMetaData meta)
Description copied from class: ExpressionStoreQuery
Return an ExpressionFactory to 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:
getExpressionFactory in class ExpressionStoreQuery

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: ExpressionStoreQuery
Execute the given expression against the given candidate extent.

Overrides:
executeQuery in class ExpressionStoreQuery
Parameters:
ex - current executor
base - the base type the query should match
metas - the independent candidate types
subclasses - true if subclasses should be included in the results
facts - the expression factory used to build the query for each base type
exps - the parsed query values
params - parameter values, or empty array
range - 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: ExpressionStoreQuery
Execute the given expression against the given candidate extent and delete the instances.

Overrides:
executeDelete in class ExpressionStoreQuery
Parameters:
ex - current executor
base - the base type the query should match
metas - the independent candidate types
subclasses - true if subclasses should be included in the results
facts - the expression factory used to build the query for each base type
exps - the parsed query values
params - 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: ExpressionStoreQuery
Execute the given expression against the given candidate extent and updates the instances.

Overrides:
executeUpdate in class ExpressionStoreQuery
Parameters:
ex - current executor
base - the base type the query should match
metas - the independent candidate types
subclasses - true if subclasses should be included in the results
facts - the expression factory used to build the query for each base type
exps - the parsed query values
params - 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: ExpressionStoreQuery
Return the commands that will be sent to the datastore in order to execute the query, typically in the database's native language.

Overrides:
getDataStoreActions in class ExpressionStoreQuery
Parameters:
base - the base type the query should match
metas - the independent candidate types
subclasses - true if subclasses should be included in the results
facts - the expression factory used to build the query for each base type
exps - the parsed query values
params - parameter values, or empty array
range - result range
Returns:
a textual description of the query to execute


Copyright © 2006-2010 Apache Software Foundation. All Rights Reserved.