Package org.apache.openjpa.datacache
Class QueryCacheStoreQuery
java.lang.Object
org.apache.openjpa.datacache.QueryCacheStoreQuery
- All Implemented Interfaces:
Serializable
,QueryOperations
,StoreQuery
A
StoreQuery
implementation that caches the OIDs involved in
the query, and can determine whether or not the query has been dirtied.- Since:
- 0.2.5.0
- Author:
- Patrick Linskey
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Result list implementation for a cached query result.Nested classes/interfaces inherited from interface org.apache.openjpa.kernel.StoreQuery
StoreQuery.Executor, StoreQuery.Range
-
Field Summary
Fields inherited from interface org.apache.openjpa.kernel.QueryOperations
OP_DELETE, OP_SELECT, OP_UPDATE
Fields 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
ConstructorDescriptionQueryCacheStoreQuery
(StoreQuery query, QueryCache cache) Create a new instance that delegates toquery
if no cached results are available. -
Method Summary
Modifier and TypeMethodDescriptionevaluate
(Object value, Object ob, Object[] params, OpenJPAStateManager sm) Return the standard filter listener for the given tag, or null.getCache()
Return theQueryCache
that this object is associated with.Get the current compilation for this query.Return the query context that has been set.Delegate.getFilterListener
(String tag) Return the standard filter listener for the given tag, or null.void
Invalidate any internal compilation state.Create a new compilation for this query.Create a new key for caching compiled query information.newDataStoreExecutor
(ClassMetaData meta, boolean subs) Return an executor for datastore execution of this query.newInMemoryExecutor
(ClassMetaData meta, boolean subs) Return an executor for in-memory execution of this query.void
Populate internal data from compilation.boolean
Whether this query requires a candidate class.boolean
Whether this query requires parameters to be declared.void
setContext
(QueryContext qctx) Set the current query context.boolean
This is invoked when the user or a facade creates a new query with an object that the system does not recognize.boolean
Return true if this query supports execution against abstract or interface types.boolean
True if this query supports datastore execution, false if it can only run in memory.boolean
True if this query supports in-memory execution, false if it can only run against the datastore.boolean
Whether this query supports declared parameters.
-
Constructor Details
-
QueryCacheStoreQuery
Create a new instance that delegates toquery
if no cached results are available.
-
-
Method Details
-
getCache
Return theQueryCache
that this object is associated with. -
getDelegate
Delegate. -
writeReplace
- Throws:
ObjectStreamException
-
getContext
Description copied from interface:StoreQuery
Return the query context that has been set.- Specified by:
getContext
in interfaceStoreQuery
-
setContext
Description copied from interface:StoreQuery
Set the current query context. This will be called before use.- Specified by:
setContext
in interfaceStoreQuery
-
setQuery
Description copied from interface:StoreQuery
This is invoked when the user or a facade creates a new query with an object that the system does not recognize. Return true if the object is recognized by the store, false otherwise.- Specified by:
setQuery
in interfaceStoreQuery
-
getFilterListener
Description copied from interface:StoreQuery
Return the standard filter listener for the given tag, or null.- Specified by:
getFilterListener
in interfaceStoreQuery
-
getAggregateListener
Description copied from interface:StoreQuery
Return the standard filter listener for the given tag, or null.- Specified by:
getAggregateListener
in interfaceStoreQuery
-
newCompilationKey
Description copied from interface:StoreQuery
Create a new key for caching compiled query information. May be null.- Specified by:
newCompilationKey
in interfaceStoreQuery
-
newCompilation
Description copied from interface:StoreQuery
Create a new compilation for this query. May be null.- Specified by:
newCompilation
in interfaceStoreQuery
-
getCompilation
Description copied from interface:StoreQuery
Get the current compilation for this query. If it is null, do not create.- Specified by:
getCompilation
in interfaceStoreQuery
-
populateFromCompilation
Description copied from interface:StoreQuery
Populate internal data from compilation.- Specified by:
populateFromCompilation
in interfaceStoreQuery
-
invalidateCompilation
public void invalidateCompilation()Description copied from interface:StoreQuery
Invalidate any internal compilation state.- Specified by:
invalidateCompilation
in interfaceStoreQuery
-
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 interfaceStoreQuery
-
supportsInMemoryExecution
public boolean supportsInMemoryExecution()Description copied from interface:StoreQuery
True if this query supports in-memory execution, false if it can only run against the datastore.- Specified by:
supportsInMemoryExecution
in interfaceStoreQuery
-
newInMemoryExecutor
Description copied from interface:StoreQuery
Return an executor for in-memory execution of this query. Executors must be cachable and thread safe. If this class returns true fromStoreQuery.supportsAbstractExecutors()
, the given metadata will always be for the candidate class of this query, or possibly null if the candidate class is not itself persistence capable (like an interface or abstract base class). Otherwise, the given type will be a mapped class.- Specified by:
newInMemoryExecutor
in interfaceStoreQuery
subs
- whether to include dependent mapped subclasses in the results; independent subclasses should never be included
-
newDataStoreExecutor
Description copied from interface:StoreQuery
Return an executor for datastore execution of this query. Executors must be cachable and thread safe. If this class returns true fromStoreQuery.supportsAbstractExecutors()
, the given metadata will always be for the candidate class of this query, or possibly null if the candidate class is not itself persistence capable (like an interface or abstract base class). Otherwise, the given type will be a mapped class.- Specified by:
newDataStoreExecutor
in interfaceStoreQuery
subs
- whether to include dependent mapped subclasses in the results; independent subclasses should never be included
-
supportsAbstractExecutors
public boolean supportsAbstractExecutors()Description copied from interface:StoreQuery
Return true if this query supports execution against abstract or interface types. Returns false by default, meaning we will only request executors for persistent classes. In this case, we will automatically combine the results of the executors for all implementing classes if we execute a query for an interface for abstract type.- Specified by:
supportsAbstractExecutors
in interfaceStoreQuery
-
requiresCandidateType
public boolean requiresCandidateType()Description copied from interface:StoreQuery
Whether this query requires a candidate class.- Specified by:
requiresCandidateType
in interfaceStoreQuery
-
requiresParameterDeclarations
public boolean requiresParameterDeclarations()Description copied from interface:StoreQuery
Whether this query requires parameters to be declared.- Specified by:
requiresParameterDeclarations
in interfaceStoreQuery
-
supportsParameterDeclarations
public boolean supportsParameterDeclarations()Description copied from interface:StoreQuery
Whether this query supports declared parameters.- Specified by:
supportsParameterDeclarations
in interfaceStoreQuery
-
evaluate
- Specified by:
evaluate
in interfaceStoreQuery
-