Return-Path: Delivered-To: apmail-db-jdo-dev-archive@www.apache.org Received: (qmail 12196 invoked from network); 25 Oct 2007 16:04:34 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 25 Oct 2007 16:04:34 -0000 Received: (qmail 8625 invoked by uid 500); 25 Oct 2007 16:04:21 -0000 Mailing-List: contact jdo-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: jdo-dev@db.apache.org Delivered-To: mailing list jdo-dev@db.apache.org Received: (qmail 8567 invoked by uid 99); 25 Oct 2007 16:04:21 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 25 Oct 2007 09:04:21 -0700 X-ASF-Spam-Status: No, hits=-0.8 required=10.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [192.18.43.132] (HELO sca-es-mail-1.sun.com) (192.18.43.132) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 25 Oct 2007 18:05:04 +0000 Received: from fe-sfbay-09.sun.com ([192.18.43.129]) by sca-es-mail-1.sun.com (8.13.7+Sun/8.12.9) with ESMTP id l9PG3xDR023544 for ; Thu, 25 Oct 2007 09:03:59 -0700 (PDT) Received: from conversion-daemon.fe-sfbay-09.sun.com by fe-sfbay-09.sun.com (Sun Java System Messaging Server 6.2-8.04 (built Feb 28 2007)) id <0JQH005015KSAA00@fe-sfbay-09.sun.com> (original mail from Craig.Russell@Sun.COM) for jdo-dev@db.apache.org; Thu, 25 Oct 2007 09:03:59 -0700 (PDT) Received: from [129.144.88.148] by fe-sfbay-09.sun.com (Sun Java System Messaging Server 6.2-8.04 (built Feb 28 2007)) with ESMTPSA id <0JQH000MU5YKSK20@fe-sfbay-09.sun.com> for jdo-dev@db.apache.org; Thu, 25 Oct 2007 09:03:56 -0700 (PDT) Date: Thu, 25 Oct 2007 09:03:43 -0700 From: Craig L Russell Subject: Re: Subquery specification update In-reply-to: <4720B83B.8040703@spree.de> Sender: Craig.Russell@Sun.COM To: jdo-dev@db.apache.org Cc: JDO Expert Group Message-id: <7FF16E30-FD64-4550-8B70-CC00A8D426F8@SUN.com> MIME-version: 1.0 X-Mailer: Apple Mail (2.752.3) Content-type: multipart/signed; protocol="application/pkcs7-signature"; boundary=Apple-Mail-113-272658962; micalg=sha1 References: <50746A9B-FB9E-4A91-818E-619BC806719D@Sun.COM> <13405438.post@talk.nabble.com> <4720B83B.8040703@spree.de> --Apple-Mail-113-272658962 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Currently, parameters are only specified to work in the result, filter, ordering, grouping, or range parts of a query, not in the FROM part. This is in both the single string version (from CandidateClassName ExcludeClause opt) and API version where the setCandidates takes either Extent or Collection, not parameter name. I'm not necessarily opposed to adding the ability to use parameters as the candidate collection, but I'd like to hear more details as to how a parameter can be used as a candidate collection, and from the implementation engineers to see if this change could be done. The only problem I have with including single string JDOQL to the examples is that it would be before the single string JDOQL topic was introduced. Would it be better to move all the subquery examples down to the examples section? Craig On Oct 25, 2007, at 8:37 AM, Michael Bouschen wrote: > Hi Matthew, hi Christiaan, >> I agree that the candidateCollectionExpression description is a >> bit cryptic. > Do you have an idea for a better description? The reason to include > something like "tokens from this query" is that we have to define > the scope for identifiers used in the > candidateCollectionExpression. So in "this.department.employees" > this denotes the candidate instance of the outer query and NOT of > the subquery. >> >> Boy, it's been a long time since I thought about subqueries. Can >> we also provide single-string versions of the examples? That >> would be helpful. > Do you mean add single string JDOQL of the examples to the spec or > provide them for this email discussion? I agree it would be useful > to add them to the spec. If you are just interested for right now: > - employees who work more than the average of all employees > SELECT FROM Employee WHERE this.weeklyhours > (SELECT AVG > (e.weeklyhours) FROM Employee e) > - employees who work more than the average of their department > employees > SELECT FROM Employee WHERE this.weeklyhours > (SELECT AVG > (e.weeklyhours) FROM this.department.employees e) > - employees who work more than the average of the employees in > their department having the same manager: > SELECT FROM Employee WHERE this.weeklyhours > > (SELECT AVG(e.weeklyhours) FROM Employee e WHERE e.manager == > this.manager) > > Christiaan, > yes, I think the query code you added to your email returns the > same result. > > Regards Michael > >> -matthew >> >> On Oct 25, 2007, at 5:07 AM, Christiaan wrote: >> >>> >>> Hi Craig, >>> the examples are very informative. I must say that I find the >>> description >>> for candidateCollectionExpression >>> "The candidateCollectionExpression is the expression using tokens >>> from >>> this query that represent the candidates over which the subquery is >>> evaluated. " >>> a little bit cryptic (I actually find the paramater name more >>> descriptive >>> than the description). Especially "tokens from this query" (is >>> tokens a >>> common word for this and may be it should be stressed that this >>> query is the >>> outer query?) and "over which the subquery is evaluated", but may >>> be this is >>> needed for the spec. >>> >>> Anyway, do I understand it correctly that it is the same as: >>> .... >>> sub.setFilter(":departmentEmployees.contains(this)"); >>> Query q = pm.newQuery(Employee.class); >>> q.setFilter("this.weeklyHours > averageWeeklyhours"); >>> q.addSubquery(sub, "double averageWeeklyhours", null, >>> "this.department.employees"); >>> >>> kind regards, >>> Christiaan >>> -- >>> View this message in context: http://www.nabble.com/Subquery- >>> specification-update-tf4686785.html#a13405438 >>> Sent from the JDO - Development mailing list archive at Nabble.com. >>> > > > -- > 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: Anna-Kristin Proefrock > Sitz Berlin, Amtsgericht Charlottenburg, HRB 564 52 > Craig Russell Architect, Sun Java Enterprise System http://java.sun.com/products/jdo 408 276-5638 mailto:Craig.Russell@sun.com P.S. A good JDO? O, Gasp! --Apple-Mail-113-272658962 Content-Transfer-Encoding: base64 Content-Type: application/pkcs7-signature; name=smime.p7s Content-Disposition: attachment; filename=smime.p7s MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQ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