[
https://issues.apache.org/jira/browse/JDO-842?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17930488#comment-17930488
]
Craig L Russell commented on JDO-842:
-------------------------------------
For review:
{color:#000000}This query deletes all Employees who make more than the
parameter salary.{color}
{color:#000000}Query q = pm.newQuery (Employee.class, "salary > sal");{color}
{color:#000000}q.declareParameters ("Float sal");{color}
{color:#000000}long deleteCount = q.deletePersistentAll(new
Float(30000.));{color}
{color:#000000}This is the JDOQLTyped version of the query:{color}
{color:#000000}NumericExpression<Float> sal = QEmployee.numericParameter("sal",
Float.class);{color}
{color:#000000}QEmployee cand = QEmployee.candidate("this");{color}
{color:#000000}JDOQLTypedQuery<Employee> q =
pm.newJDOQLTypedQuery(Employee.class){color}
{color:#000000}.setParameter(sal, new Float(30000.){color}
{color:#000000}.filter(cand.salary > sal);{color}
{color:#000000}long deleteCount = q.deletePersistentAll();{color}
> Q class specification of candidate() method
> -------------------------------------------
>
> Key: JDO-842
> URL: https://issues.apache.org/jira/browse/JDO-842
> Project: JDO
> Issue Type: Bug
> Components: specification
> Affects Versions: JDO 3.2.1
> Reporter: Tilmann Zäschke
> Priority: Major
>
> The specification does not clearly specify the behavior of the Q classes in
> Section "14.10 Typesafe Query Construction"
> The examples in section "14.11 Examples" use the following methods of
> generated Q-classes:
> * candidate()
> * candidate(String)
> * variable(String)
> Both candidate methods are used in the query examples, but they are not
> specified as part of the typesafe query support.
> Specific points that we should possibly mention:
> * These methods should allow Q classes to be used concurrently.
> Specifically, they should all return *new* instances. The current
> specification allows returning shared multiple instances which causes
> problems when used concurrently. (the reference implementation currently does
> this for 'candidate()').
> * The reference implementation also has a 'parameter(String)' method. We may
> want to add this to the spec.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)