db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Bouschen <mbo.t...@spree.de>
Subject JDO spec remarks (subqueries)
Date Mon, 04 Feb 2008 20:09:28 GMT
Hi Craig,

I went through the query chapter of the January 18 version of the JDO 
spec and would like to propose a few changes to be added to describe 
subqueries:

- section "14.3 Architecture: Query"
The subsection titled "Other elements in queries include:" should get a 
new bullet about subqueries.

-section "14.6 Query Interface"
The subsection "Query element binding" should mention the 4 new methods 
addSubquery to support subqueries.

- section "14.6.13 Single-string Query element binding"
I propose to mention subqueries in this section. Maybe after the 
sentence "<filter> is the filter as in 14.6.2.", something like:
The filter in the single String form may include subqueries. A suquery
has the following structure:
  select subquery-result-clause from subquery-from-clause where filter decls
The subquery-result-clause consists of an optional keyword distinct 
followed by a single expression.
The subquery-from-clause may have one of two forms:
- A candidate class name followed by an optional alias definition 
followed by an optional exclude subclasses
- A field access expression followed by an optional alias definition
An alias definition consists of an optional keyword as followed by an 
identifier. This identifier may be used instead of this to access the 
candidate instances of the subquery.

- section "14.10 Examples"
How about adding one or two subquery examples?  We could use the TCK 
subqueries as examples, e.g.
- Class NonCorrelatedSubqueries method runTestSubqueries01: select 
employees who work more than the average of all employees:
SELECT FROM com.xyz.hr.Employee WHERE this.weeklyhours > (SELECT 
AVG(e.weeklyhours) FROM com.xyz.hr.Employee e)
- Class CorrelatedSubqueriesWithParameters method runTestSubqueries01: 
select employees who work more than the average of the employees in 
their department having the same
manager:
SELECT FROM "com.xyz.hr.Employee WHERE this.weeklyhours > (SELECT 
AVG(e.weeklyhours) FROM this.department.employees e WHERE e.manager == 
this.manager)

Regards Michael

-- 
Tech@Spree Engineering GmbH  Tel.: +49/(0)30/235 520-33
Buelowstr. 66                Fax.: +49/(0)30/217 520-12
10783 Berlin                 mailto:mbo.tech@spree.de 
 
Geschaeftsfuehrung: Martin Weber
Sitz Berlin, Amtsgericht Charlottenburg, HRB 564 52


Mime
View raw message