Class AbstractJPQLQuery

All Implemented Interfaces:
Serializable, ExecutionContextListener

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:
  • Field Details

  • Constructor Details

    • AbstractJPQLQuery

      public AbstractJPQLQuery(StoreManager storeMgr, ExecutionContext ec)
      Constructor.
      Parameters:
      storeMgr - StoreManager for this query
      ec - ExecutionContext
    • AbstractJPQLQuery

      public AbstractJPQLQuery(StoreManager storeMgr, ExecutionContext ec, AbstractJPQLQuery q)
      Constructs a new query instance having the same criteria as the given query.
      Parameters:
      storeMgr - StoreManager for this query
      ec - ExecutionContext
      q - The query from which to copy criteria.
    • AbstractJPQLQuery

      public AbstractJPQLQuery(StoreManager storeMgr, ExecutionContext ec, String query)
      Constructor for a JPQL query where the query is specified using the "Single-String" format.
      Parameters:
      storeMgr - StoreManager for this query
      ec - ExecutionContext
      query - The query string
  • Method Details

    • 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 class Query
      Returns:
      The supported extension names
    • setResult

      public void setResult(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
    • 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 class AbstractJavaQuery
      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 class AbstractJavaQuery
      Parameters:
      parameterValues - Values for any parameters
    • compileInternal

      protected void compileInternal(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.
    • compileSubqueries

      protected void compileSubqueries(Map<String,Query.SubqueryDefinition> subqueryMap, QueryCompilation parentCompilation, JavaQueryCompiler parentCompiler, Map parameterValues)
      Recursively compile the subqueries
      Parameters:
      subqueryMap - The subquery definition map
      parentCompilation - The parent compilation
      parentCompiler - The parent compiler
      parameterValues - The parameters map
    • resolveClassDeclaration

      public Class resolveClassDeclaration(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 String getLanguage()
      Accessor for the query language.
      Overrides:
      getLanguage in class Query
      Returns:
      Query language