Package org.datanucleus.store.query
Class AbstractJavaQuery<T>
- java.lang.Object
-
- org.datanucleus.store.query.Query<T>
-
- org.datanucleus.store.query.AbstractJavaQuery<T>
-
- All Implemented Interfaces:
java.io.Serializable,ExecutionContextListener
- Direct Known Subclasses:
AbstractJDOQLQuery,AbstractJPQLQuery
public abstract class AbstractJavaQuery<T> extends Query<T>
Abstract representation of a Java-based query. To be extended by Java-based query languages.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.datanucleus.store.query.Query
Query.QueryType, Query.SubqueryDefinition
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Collection<T>candidateCollectionCollection of candidates for this query.private static longserialVersionUIDprotected java.lang.StringsingleStringCached form of the single string form of the query.-
Fields inherited from class org.datanucleus.store.query.Query
candidateClass, candidateClassName, clr, compilation, ec, explicitParameters, explicitVariables, EXTENSION_CHECK_UNUSED_PARAMETERS, EXTENSION_CLOSE_RESULTS_AT_EC_CLOSE, EXTENSION_COMPILATION_CACHED, EXTENSION_COMPILE_OPTIMISE_VAR_THIS, EXTENSION_EVALUATE_IN_MEMORY, EXTENSION_EXCLUDE_SUBCLASSES, EXTENSION_FLUSH_BEFORE_EXECUTION, EXTENSION_JDOQL_ALLOW_ALL, EXTENSION_JDOQL_STRICT, EXTENSION_JPQL_ALLOW_RANGE, EXTENSION_JPQL_STRICT, EXTENSION_LOAD_RESULTS_AT_COMMIT, EXTENSION_QUERY_TYPE, EXTENSION_RESULT_CACHE_TYPE, EXTENSION_RESULT_CACHE_VALIDATE_OBJECTS, EXTENSION_RESULT_SIZE_METHOD, EXTENSION_RESULTS_CACHED, EXTENSION_SQL_ALLOW_ALL, EXTENSION_SQL_SYNTAX_CHECKS, EXTENSION_UPDATE_ALL_CANDIDATE_FIELDS, EXTENSION_USE_FETCH_PLAN, extensions, filter, from, fromInclNo, fromInclParam, grouping, having, ignoreCache, implicitParameters, imports, inputParameters, insertFields, insertSelectQuery, ordering, parameterNames, parsedImports, queryResults, range, result, resultClass, resultClassName, resultDistinct, storeMgr, subclasses, subqueries, tasks, toExclNo, toExclParam, type, unique, unmodifiable, update
-
-
Constructor Summary
Constructors Constructor Description AbstractJavaQuery(StoreManager storeMgr, ExecutionContext ec)Constructor for a Java-based query.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidcompileGeneric(java.util.Map<java.lang.Object,java.lang.Object> parameterValues)Method to generate the generic compilation of this query.protected java.lang.StringdereferenceFilter(java.lang.String input)Method to expand the subqueries defined in a filter.protected voiddiscardCompiled()Method to discard our current compiled query due to changes.protected booleanevaluateInMemory()Convenience method to return whether the query should be evaluated in-memory.abstract java.lang.StringgetSingleStringQuery()Accessor for a single string form of the query.protected longperformDeletePersistentAll(java.util.Map parameters)Execute the query to delete persistent objects.voidsetCandidates(java.util.Collection<T> pcs)Set the candidate collection to query.voidsetCandidates(Extent<T> pcs)Set the candidate Extent to query.java.lang.StringtoString()Stringifier method-
Methods inherited from class org.datanucleus.store.query.Query
addExtension, addSubquery, applyImplicitParameterValueToCompilation, applyImplicitParameterValueToSubqueries, assertIsModifiable, assertIsOpen, assertSupportsCancel, cancel, cancel, cancelTaskObject, checkForMissingParameters, checkParameterTypesAgainstCompilation, checkUnusedParameters, close, closeAll, compile, compileInternal, declareExplicitParameters, declareExplicitVariables, declareImports, deepFindSymbolForParameterInCompilation, deletePersistentAll, deletePersistentAll, deletePersistentAll, deregisterTask, equals, execute, executeQuery, executeWithArray, executeWithMap, executionContextClosing, getBooleanExtensionProperty, getCandidateClass, getCandidateClassMetaData, getCandidateClassName, getCompilation, getDatastoreReadTimeoutMillis, getDatastoreWriteTimeoutMillis, getExecutionContext, getExplicitParametersDeclaration, getExplicitVariablesDeclaration, getExtension, getExtensions, getFetchPlan, getFilter, getFrom, getGrouping, getHaving, getIgnoreCache, getImplicitParameters, getImportsDeclaration, getInputParameters, getInsertFields, getInsertSelectQuery, getLanguage, getNativeQuery, getOrdering, getParameterMapForValues, getParsedImports, getQueryManager, getRange, getRangeFromIncl, getRangeFromInclParam, getRangeToExcl, getRangeToExclParam, getResult, getResultClass, getResultClassName, getResultDistinct, getSerializeRead, getStoreManager, getStringExtensionProperty, getSubqueryForVariable, getSupportedExtensions, getType, getUpdate, hashCode, hasSubqueryForVariable, isCompiled, isSubclasses, isUnique, isUnmodifiable, performExecute, prepareDatastore, processesRangeInDatastoreQuery, registerTask, resolveClassDeclaration, setCacheResults, setCandidateClass, setCandidateClassName, setCompilation, setDatastoreReadTimeoutMillis, setDatastoreWriteTimeoutMillis, setExtensions, setFetchPlan, setFilter, setFrom, setGrouping, setHaving, setIgnoreCache, setImplicitParameter, setImplicitParameter, setInsertFields, setInsertSelectQuery, setOrdering, setRange, setRange, setResult, setResultClass, setResultClassName, setResultDistinct, setResultMetaData, setSerializeRead, setSubclasses, setType, setUnique, setUnmodifiable, setUpdate, shouldReturnSingleRow, supportsTimeout, useCaching, useFetchPlan, useResultsCaching
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
candidateCollection
protected transient java.util.Collection<T> candidateCollection
Collection of candidates for this query.
-
singleString
protected java.lang.String singleString
Cached form of the single string form of the query.
-
-
Constructor Detail
-
AbstractJavaQuery
public AbstractJavaQuery(StoreManager storeMgr, ExecutionContext ec)
Constructor for a Java-based query.- Parameters:
storeMgr- StoreManager for this queryec- ExecutionContext
-
-
Method Detail
-
setCandidates
public void setCandidates(Extent<T> pcs)
Set the candidate Extent to query. Passing in null clears off the current candidate Extent.- Specified by:
setCandidatesin classQuery<T>- Parameters:
pcs- the Candidate Extent.
-
setCandidates
public void setCandidates(java.util.Collection<T> pcs)
Set the candidate collection to query. Passing in null clears off the current candidate collection.- Specified by:
setCandidatesin classQuery<T>- Parameters:
pcs- the Candidate collection.
-
discardCompiled
protected void discardCompiled()
Method to discard our current compiled query due to changes.- Overrides:
discardCompiledin classQuery<T>- See Also:
Query.discardCompiled()
-
compileGeneric
public abstract void compileGeneric(java.util.Map<java.lang.Object,java.lang.Object> parameterValues)
Method to generate the generic compilation of this query.- Parameters:
parameterValues- Values for any parameters
-
performDeletePersistentAll
protected long performDeletePersistentAll(java.util.Map parameters)
Execute the query to delete persistent objects.- Overrides:
performDeletePersistentAllin classQuery<T>- Parameters:
parameters- the Map containing all of the parameters.- Returns:
- the number of deleted objects.
-
getSingleStringQuery
public abstract java.lang.String getSingleStringQuery()
Accessor for a single string form of the query.- Returns:
- Single string form of the query.
-
toString
public java.lang.String toString()
Stringifier method- Overrides:
toStringin classjava.lang.Object- Returns:
- Single-string form of this query.
-
evaluateInMemory
protected boolean evaluateInMemory()
Convenience method to return whether the query should be evaluated in-memory.- Returns:
- Use in-memory evaluation?
-
dereferenceFilter
protected java.lang.String dereferenceFilter(java.lang.String input)
Method to expand the subqueries defined in a filter.- Parameters:
input- the input string- Returns:
- The filter expanded
-
-