org.datanucleus.store.query
Class AbstractJPQLQuery

java.lang.Object
  extended by org.datanucleus.store.query.Query
      extended by org.datanucleus.store.query.AbstractJavaQuery
          extended by org.datanucleus.store.query.AbstractJPQLQuery
All Implemented Interfaces:
java.io.Serializable

public abstract class AbstractJPQLQuery
extends AbstractJavaQuery

Abstract representation of a JPQL query used by DataNucleus. 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.SubqueryDefinition
 
Field Summary
 
Fields inherited from class org.datanucleus.store.query.AbstractJavaQuery
candidateCollection, candidateExtent, singleString
 
Fields inherited from class org.datanucleus.store.query.Query
BULK_DELETE, BULK_UPDATE, candidateClass, candidateClassName, clr, compilation, ec, explicitParameters, explicitVariables, extensions, filter, from, fromInclNo, fromInclParam, grouping, having, ignoreCache, implicitParameters, imports, LOCALISER, ordering, OTHER, parameterNames, parsedImports, queryResults, range, result, resultClass, resultClassName, resultDistinct, SELECT, subclasses, subqueries, tasks, toExclNo, toExclParam, type, unique, unmodifiable, update
 
Constructor Summary
AbstractJPQLQuery(ExecutionContext ec)
          Constructor.
AbstractJPQLQuery(ExecutionContext ec, AbstractJPQLQuery q)
          Constructs a new query instance having the same criteria as the given query.
AbstractJPQLQuery(ExecutionContext ec, java.lang.String query)
          Constructor for a JPQL query where the query is specified using the "Single-String" format.
 
Method Summary
protected  void compileInternal(java.util.Map parameterValues)
          Method to compile the JPQL query.
 java.lang.String getLanguage()
          Accessor for the query language.
 java.lang.String getSingleStringQuery()
          Method to take the defined parameters for the query and form a single string.
 java.lang.Class resolveClassDeclaration(java.lang.String classDecl)
          Utility to resolve the declaration to a particular class.
 void setResult(java.lang.String result)
          Set the result for the results.
 
Methods inherited from class org.datanucleus.store.query.AbstractJavaQuery
discardCompiled, evaluateInMemory, getCandidateCollection, getCandidateExtent, getSupportedExtensions, performDeletePersistentAll, setCandidates, setCandidates, toString
 
Methods inherited from class org.datanucleus.store.query.Query
addExtension, addSubquery, applyImplicitParameterValueToCompilation, applyRangeChecks, assertIsModifiable, assertSupportsCancel, cancel, cancel, checkParameterTypesAgainstCompilation, checkUnusedParameters, close, closeAll, compile, declareExplicitParameters, declareExplicitVariables, declareImports, deletePersistentAll, deletePersistentAll, deletePersistentAll, equals, execute, executeInSeparateThread, executeQuery, executeWithArray, executeWithMap, getBooleanExtensionProperty, getCandidateClass, getCandidateClassName, getCompilation, getDatastoreReadTimeoutMillis, getDatastoreWriteTimeoutMillis, getExplicitParameters, getExplicitVariables, getExtension, getExtensions, getFetchPlan, getFilter, getFrom, getGrouping, getHaving, getIgnoreCache, getImplicitParameters, getImports, getInputParameters, getObjectManager, getOrdering, getParameterMapForValues, getParsedImports, getQueryManager, getRange, getRangeFromIncl, getRangeFromInclParam, getRangeToExcl, getRangeToExclParam, getResult, getResultClass, getResultClassName, getResultDistinct, getSerializeRead, getStoreManager, getSubqueryForVariable, getType, getUpdate, hashCode, hasSubqueryForVariable, isCompiled, isSubclasses, isUnique, isUnmodifiable, performExecute, performExecuteInternal, performExecuteTask, prepareDatastore, setCandidateClassName, setClass, setCompilation, setDatastoreReadTimeoutMillis, setDatastoreWriteTimeoutMillis, setExtensions, setFetchPlan, setFilter, setFrom, setGrouping, setHaving, setIgnoreCache, setImplicitParameter, setImplicitParameter, setOrdering, setRange, setRange, setResultClass, setResultClassName, setResultDistinct, setResultMetaData, setSerializeRead, setSubclasses, setType, setUnique, setUnmodifiable, setUpdate, shouldReturnSingleRow, supportsTimeout, useCaching, useFetchPlan, useResultsCaching
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractJPQLQuery

public AbstractJPQLQuery(ExecutionContext ec)
Constructor.

Parameters:
ec - ExecutionContext

AbstractJPQLQuery

public AbstractJPQLQuery(ExecutionContext ec,
                         AbstractJPQLQuery q)
Constructs a new query instance having the same criteria as the given query.

Parameters:
ec - ExecutionContext
q - The query from which to copy criteria.

AbstractJPQLQuery

public AbstractJPQLQuery(ExecutionContext ec,
                         java.lang.String query)
Constructor for a JPQL query where the query is specified using the "Single-String" format.

Parameters:
ec - ExecutionContext
query - The query string
Method Detail

setResult

public void setResult(java.lang.String result)
Set the result for the results.

Overrides:
setResult in class Query
Parameters:
result - Optional keyword "distinct" followed by comma-separated list of result expressions or a result class

getSingleStringQuery

public java.lang.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 class AbstractJavaQuery
Returns:
The single string

compileInternal

protected void compileInternal(java.util.Map parameterValues)
Method to compile the JPQL query. This implementation assumes that we are using the "generic" JPQL compiler in org.datanucleus.query.compiler. If not then override this method. Will populate the "compilation" class variable.

Specified by:
compileInternal in class Query
Parameters:
parameterValues - Map of param values keyed by param name.

resolveClassDeclaration

public java.lang.Class resolveClassDeclaration(java.lang.String classDecl)
Utility to resolve the declaration to a particular class. Takes the passed in name, together with the defined import declarations and returns the class represented by the declaration.

Overrides:
resolveClassDeclaration in class Query
Parameters:
classDecl - The declaration
Returns:
The class it resolves to (if any)
Throws:
NucleusUserException - Thrown if the class cannot be resolved.

getLanguage

public java.lang.String getLanguage()
Accessor for the query language.

Overrides:
getLanguage in class Query
Returns:
Query language


Copyright © 2011. All Rights Reserved.