Package org.datanucleus.store.query
Class AbstractJDOQLQuery
- java.lang.Object
-
- org.datanucleus.store.query.Query<T>
-
- org.datanucleus.store.query.AbstractJavaQuery
-
- org.datanucleus.store.query.AbstractJDOQLQuery
-
- All Implemented Interfaces:
Serializable
,ExecutionContextListener
- Direct Known Subclasses:
FederatedJDOQLQuery
public abstract class AbstractJDOQLQuery extends AbstractJavaQuery
Abstract representation of a JDOQL query. The query can be specified via method calls, or via a single-string form.- See Also:
Query
, Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.datanucleus.store.query.Query
Query.QueryType, Query.SubqueryDefinition
-
-
Field Summary
-
Fields inherited from class org.datanucleus.store.query.AbstractJavaQuery
candidateCollection, singleString
-
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_EVALUATE_IN_MEMORY, EXTENSION_EXCLUDE_SUBCLASSES, EXTENSION_FLUSH_BEFORE_EXECUTION, EXTENSION_JDOQL_STRICT, EXTENSION_JPQL_STRICT, EXTENSION_LOAD_RESULTS_AT_COMMIT, EXTENSION_MULTITHREAD, EXTENSION_RESULT_CACHE_TYPE, EXTENSION_RESULT_SIZE_METHOD, EXTENSION_RESULTS_CACHED, EXTENSION_SQL_SYNTAX_CHECKS, EXTENSION_USE_FETCH_PLAN, extensions, filter, from, fromInclNo, fromInclParam, grouping, having, ignoreCache, implicitParameters, imports, inputParameters, insertFields, insertSelectQuery, LANGUAGE_JDOQL, LANGUAGE_JPQL, LANGUAGE_SQL, ordering, parameterNames, parsedImports, queryResults, range, result, resultClass, resultClassName, resultDistinct, storeMgr, subclasses, subqueries, tasks, toExclNo, toExclParam, type, unique, unmodifiable, update
-
-
Constructor Summary
Constructors Constructor Description AbstractJDOQLQuery(StoreManager storeMgr, ExecutionContext ec)
Constructor.AbstractJDOQLQuery(StoreManager storeMgr, ExecutionContext ec, String query)
Constructor for a JDOQL query where the query is specified using the "Single-String" format.AbstractJDOQLQuery(StoreManager storeMgr, ExecutionContext ec, AbstractJDOQLQuery q)
Constructs a new query instance having the same criteria as the given query.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
compileGeneric(Map parameterValues)
Method to generate the generic compilation of this query.protected void
compileInternal(Map parameterValues)
Method to compile the JDOQL query.protected void
compileSubqueries(Map<String,Query.SubqueryDefinition> subqueryMap, QueryCompilation parentCompilation, JavaQueryCompiler parentCompiler, Map parameterValues)
Recursively compile the subqueriesString
getLanguage()
Accessor for the query language.protected String
getQueryCacheKey()
Method to get key for query cacheString
getSingleStringQuery()
Method to take the defined parameters for the query and form a single string.Set<String>
getSupportedExtensions()
Method to return the names of the extensions supported by this query.void
setGrouping(String grouping)
Set the grouping specification for the result Collection.void
setResult(String result)
Set the result for the results.-
Methods inherited from class org.datanucleus.store.query.AbstractJavaQuery
dereferenceFilter, discardCompiled, evaluateInMemory, performDeletePersistentAll, setCandidates, setCandidates, toString
-
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, 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, getNativeQuery, getOrdering, getParameterMapForValues, getParsedImports, getQueryManager, getRange, getRangeFromIncl, getRangeFromInclParam, getRangeToExcl, getRangeToExclParam, getResult, getResultClass, getResultClassName, getResultDistinct, getSerializeRead, getStoreManager, getStringExtensionProperty, getSubqueryForVariable, getType, getUpdate, hashCode, hasSubqueryForVariable, isCompiled, isSubclasses, isUnique, isUnmodifiable, performExecute, prepareDatastore, processesRangeInDatastoreQuery, registerTask, resolveClassDeclaration, setCacheResults, setCandidateClass, setCandidateClassName, setCompilation, setDatastoreReadTimeoutMillis, setDatastoreWriteTimeoutMillis, setExtensions, setFetchPlan, setFilter, setFrom, setHaving, setIgnoreCache, setImplicitParameter, setImplicitParameter, setInsertFields, setInsertSelectQuery, setOrdering, setRange, setRange, setResultClass, setResultClassName, setResultDistinct, setResultMetaData, setSerializeRead, setSubclasses, setType, setUnique, setUnmodifiable, setUpdate, shouldReturnSingleRow, supportsTimeout, useCaching, useFetchPlan, useResultsCaching
-
-
-
-
Constructor Detail
-
AbstractJDOQLQuery
public AbstractJDOQLQuery(StoreManager storeMgr, ExecutionContext ec)
Constructor.- Parameters:
storeMgr
- StoreManager for this queryec
- execution context
-
AbstractJDOQLQuery
public AbstractJDOQLQuery(StoreManager storeMgr, ExecutionContext ec, AbstractJDOQLQuery q)
Constructs a new query instance having the same criteria as the given query.- Parameters:
storeMgr
- StoreManager for this queryec
- execution contextq
- The query from which to copy criteria.
-
AbstractJDOQLQuery
public AbstractJDOQLQuery(StoreManager storeMgr, ExecutionContext ec, String query)
Constructor for a JDOQL query where the query is specified using the "Single-String" format.- Parameters:
storeMgr
- StoreManager for this queryec
- execution contextquery
- The query string
-
-
Method Detail
-
getSupportedExtensions
public Set<String> getSupportedExtensions()
Method to return the names of the extensions supported by this query. To be overridden by subclasses where they support additional extensions.- Overrides:
getSupportedExtensions
in classQuery
- Returns:
- The supported extension names
-
setGrouping
public void setGrouping(String grouping)
Set the grouping specification for the result Collection.- Overrides:
setGrouping
in classQuery
- Parameters:
grouping
- the grouping specification.
-
setResult
public void setResult(String result)
Set the result for the results.
-
getQueryCacheKey
protected String getQueryCacheKey()
Method to get key for query cache- Returns:
- The cache key
-
getSingleStringQuery
public String getSingleStringQuery()
Method to take the defined parameters for the query and form a single string. This is used to print out the query for logging.- Specified by:
getSingleStringQuery
in classAbstractJavaQuery
- Returns:
- The single string
-
compileGeneric
public void compileGeneric(Map parameterValues)
Description copied from class:AbstractJavaQuery
Method to generate the generic compilation of this query.- Specified by:
compileGeneric
in classAbstractJavaQuery
- Parameters:
parameterValues
- Values for any parameters
-
compileInternal
protected void compileInternal(Map parameterValues)
Method to compile the JDOQL query. This implementation assumes that we are using the "generic" JDOQL compiler in org.datanucleus.query.compiler. If not then override this method. Will populate the "compilation" class variable.- Specified by:
compileInternal
in classQuery
- Parameters:
parameterValues
- Map of parameter values keyed by parameter name.
-
compileSubqueries
protected void compileSubqueries(Map<String,Query.SubqueryDefinition> subqueryMap, QueryCompilation parentCompilation, JavaQueryCompiler parentCompiler, Map parameterValues)
Recursively compile the subqueries- Parameters:
subqueryMap
- The subquery definition mapparentCompilation
- Parent compilationparentCompiler
- The parent compilerparameterValues
- The parameters map
-
getLanguage
public String getLanguage()
Accessor for the query language.- Overrides:
getLanguage
in classQuery
- Returns:
- Query language
-
-