org.jpox.store.rdbms.query
Class JDOQLQuery

java.lang.Object
  extended by org.jpox.store.query.Query
      extended by org.jpox.store.query.AbstractJavaQuery
          extended by org.jpox.store.query.AbstractJDOQLQuery
              extended by org.jpox.store.rdbms.query.JDOQLQuery
All Implemented Interfaces:
java.io.Serializable

public class JDOQLQuery
extends org.jpox.store.query.AbstractJDOQLQuery

RDBMS representation of a JDOQL query for use by JPOX. The query can be specified via method calls, or via a single-string form.

Version:
$Revision: 1.40 $
See Also:
Query, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jpox.store.query.Query
org.jpox.store.query.Query.SubqueryDefinition
 
Field Summary
protected  org.jpox.store.mapped.query.Queryable candidates
          Candidates for this query.
protected  org.jpox.store.mapped.expression.QueryExpression queryStmt
          The Query Statement.
 
Fields inherited from class org.jpox.store.query.AbstractJavaQuery
candidateCollection, candidateExtent, distinct, resultMetaData, rof, singleString, userDefinedScalarExpressions
 
Fields inherited from class org.jpox.store.query.Query
BULK_DELETE, BULK_UPDATE, candidateClass, candidateClassName, explicitParameters, explicitVariables, extensions, filter, from, fromInclNo, grouping, having, ignoreCache, implicitParameters, imports, isCompiled, LOCALISER, om, ordering, parameterNames, parsedImports, queryResults, range, result, resultClass, resultClassName, SELECT, subclasses, subqueries, toExclNo, type, unique, unmodifiable, update
 
Constructor Summary
JDOQLQuery(org.jpox.ObjectManager om)
          Constructs a new query instance that uses the given persistence manager.
JDOQLQuery(org.jpox.ObjectManager om, JDOQLQuery q)
          Constructs a new query instance having the same criteria as the given query.
JDOQLQuery(org.jpox.ObjectManager om, java.lang.String query)
          Constructor for a JDOQL query where the query is specified using the "Single-String" format.
 
Method Summary
protected  boolean applyRangeChecks()
          Method to return if the query results should have the range checked and unnecessary rows discarded.
protected  void compileInternal(boolean forExecute, java.util.Map parameterValues)
          Method to compile the query.
protected  void discardCompiled()
          Method to discard our current compiled query due to changes.
 boolean equals(java.lang.Object obj)
          Equality operator for JDOQL.
 org.jpox.store.mapped.query.Queryable getCandidates()
          Accessor for the candidates for the query.
protected  org.jpox.store.mapped.query.Evaluator getEvaluator(org.jpox.ObjectManager om, boolean distinct, org.jpox.store.query.Query query, org.jpox.store.query.ResultObjectFactory rof, java.util.Collection candidateCollection)
          Method to return the evaluator to use for this JDOQL query.
protected  java.lang.Object performExecute(java.util.Map parameters)
          Execute the query and return the filtered QueryResult.
protected  boolean shouldReturnSingleRow()
          Convenience method to return whether the query should return a single row.
 
Methods inherited from class org.jpox.store.query.AbstractJDOQLQuery
getSingleStringQuery, performDeletePersistentAll, setGrouping
 
Methods inherited from class org.jpox.store.query.AbstractJavaQuery
getCandidateCollection, getCandidateExtent, getParsedImports, getResultSetMetaData, getUserDefinedScalarExpressions, registerScalarExpression, registerScalarExpressions, resultHasOnlyAggregates, setCandidates, setCandidates, toString
 
Methods inherited from class org.jpox.store.query.Query
addExtension, addSubquery, assertIsModifiable, close, closeAll, compile, declareExplicitParameters, declareExplicitVariables, declareImports, deletePersistentAll, deletePersistentAll, deletePersistentAll, execute, execute, execute, execute, executeWithArray, executeWithMap, getCandidateClass, getCandidateClassName, getExplicitParameters, getExplicitVariables, getExtension, getFetchPlan, getFilter, getFrom, getGrouping, getHaving, getIgnoreCache, getImports, getObjectManager, getOrdering, getRange, getRangeFromIncl, getRangeToExcl, getResult, getResultClass, getResultClassName, getStoreManager, getSubqueryForVariable, getType, getUpdate, hashCode, hasSubqueryForVariable, isCompiled, isSubclasses, isUnique, isUnmodifiable, prepareDatastore, resolveClassDeclaration, setCandidateClassName, setClass, setExtensions, setFetchPlan, setFilter, setFrom, setHaving, setIgnoreCache, setImplicitParameter, setImplicitParameter, setOrdering, setRange, setRange, setResult, setResultClass, setResultClassName, setResultMetaData, setSubclasses, setType, setUnique, setUnmodifiable, setUpdate
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

queryStmt

protected transient org.jpox.store.mapped.expression.QueryExpression queryStmt
The Query Statement.


candidates

protected transient org.jpox.store.mapped.query.Queryable candidates
Candidates for this query.

Constructor Detail

JDOQLQuery

public JDOQLQuery(org.jpox.ObjectManager om)
Constructs a new query instance that uses the given persistence manager.

Parameters:
om - the associated ObjectManager for this query.

JDOQLQuery

public JDOQLQuery(org.jpox.ObjectManager om,
                  JDOQLQuery q)
Constructs a new query instance having the same criteria as the given query.

Parameters:
om - The ObjectManager
q - The query from which to copy criteria.

JDOQLQuery

public JDOQLQuery(org.jpox.ObjectManager om,
                  java.lang.String query)
Constructor for a JDOQL query where the query is specified using the "Single-String" format.

Parameters:
om - The persistence manager
query - The query string
Method Detail

getCandidates

public org.jpox.store.mapped.query.Queryable getCandidates()
Accessor for the candidates for the query. This is only valid after compiling the query.

Returns:
Candidates for the query

equals

public boolean equals(java.lang.Object obj)
Equality operator for JDOQL.

Overrides:
equals in class org.jpox.store.query.Query
See Also:
Object.equals(java.lang.Object)

compileInternal

protected void compileInternal(boolean forExecute,
                               java.util.Map parameterValues)
Method to compile the query.

Specified by:
compileInternal in class org.jpox.store.query.Query
Parameters:
forExecute - Whether to compile ready for execution

discardCompiled

protected void discardCompiled()
Method to discard our current compiled query due to changes.

Overrides:
discardCompiled in class org.jpox.store.query.AbstractJavaQuery
See Also:
Query.discardCompiled()

shouldReturnSingleRow

protected boolean shouldReturnSingleRow()
Convenience method to return whether the query should return a single row.

Specified by:
shouldReturnSingleRow in class org.jpox.store.query.Query
Returns:
Whether a single row should result

performExecute

protected java.lang.Object performExecute(java.util.Map parameters)
Execute the query and return the filtered QueryResult.

Specified by:
performExecute in class org.jpox.store.query.Query
Parameters:
parameters - Map containing all of the parameters.
Returns:
the filtered QueryResult.

getEvaluator

protected org.jpox.store.mapped.query.Evaluator getEvaluator(org.jpox.ObjectManager om,
                                                             boolean distinct,
                                                             org.jpox.store.query.Query query,
                                                             org.jpox.store.query.ResultObjectFactory rof,
                                                             java.util.Collection candidateCollection)
Method to return the evaluator to use for this JDOQL query.

Parameters:
query - The query
distinct - whether to return distinct results
rof - ResultObjectFactory
candidateCollection - Any candidate collection
Returns:
The evaluator

applyRangeChecks

protected boolean applyRangeChecks()
Method to return if the query results should have the range checked and unnecessary rows discarded. This is for where the query language has specified a range but the datastore doesnt allow removal of unnecessary results in the query itself (so has to be done in post-processing). This implementation returns false and so should be overridden by query languages to match their capabilities.

Overrides:
applyRangeChecks in class org.jpox.store.query.Query
Returns:
Whether to apply range checks in post-processing of results.


Copyright © -2008 . All Rights Reserved.