Return-Path: Delivered-To: apmail-cayenne-user-archive@www.apache.org Received: (qmail 13332 invoked from network); 21 Feb 2008 19:41:30 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 21 Feb 2008 19:41:29 -0000 Received: (qmail 74497 invoked by uid 500); 21 Feb 2008 19:41:23 -0000 Delivered-To: apmail-cayenne-user-archive@cayenne.apache.org Received: (qmail 73688 invoked by uid 500); 21 Feb 2008 19:41:20 -0000 Mailing-List: contact user-help@cayenne.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cayenne.apache.org Delivered-To: mailing list user@cayenne.apache.org Received: (qmail 73567 invoked by uid 99); 21 Feb 2008 19:41:19 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 21 Feb 2008 11:41:18 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [64.61.35.66] (HELO servprise.com) (64.61.35.66) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 21 Feb 2008 19:40:30 +0000 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: Queries based on relationship size Date: Thu, 21 Feb 2008 14:40:44 -0500 Message-ID: <384329B8D7108B45A3064FB38FCF267B19FBFA@aristotle.servprise.office> In-Reply-To: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Queries based on relationship size Thread-Index: Ach0kY+8EGspbZrMQx2epK0epZcy3AAL88sA References: <384329B8D7108B45A3064FB38FCF267B19FBD4@aristotle.servprise.office> From: "Kevin Menard" To: X-Virus-Checked: Checked by ClamAV on apache.org Thanks. I'll have to give that a go over the weekend. Unfortunately, my API structure is centered around SelectQuery and a visitor for adding expressions and orderings. Changing the root query type will require a few more changes than I was hoping for. At least it'll give me an excuse to finally play with EJB QL. --=20 Kevin Menard Servprise International, Inc. Remote reboot & power control for your network www.servprise.com +1 508.892.3823 x308 > -----Original Message----- > From: Andrus Adamchik [mailto:andrus@objectstyle.org] > Sent: Thursday, February 21, 2008 8:56 AM > To: user@cayenne.apache.org > Subject: Re: Queries based on relationship size >=20 > EJBQL query with outer joins should help: >=20 > 1. select c from Customer c JOIN c.orderHistory >=20 > (inner join filters customers with Orders, so this is like a > regular SelectQuery) >=20 > 2. select c from Customer c LEFT JOIN c.orderHistory d WHERE d is null >=20 > (outer join combined with the WHERE clause should allow fetching > customers with no orders) >=20 > Two caveats: we still need to add pagination support per CAY-963; I > may have taken a few _temporary_ shortcuts in the EJBQL parser that > may cause trouble with flattened relationships, so let me know if you > run into problems. >=20 > Andrus >=20 >=20 >=20 > On Feb 21, 2008, at 3:05 AM, Kevin Menard wrote: >=20 > > Greetings, > > > > I'm running into a little difficulty performing a query that I think > > comes up often enough that it should be fairly straightforward. > > > > I have a schema similar to the following: > > > > Customer <--- BillingInfo <--- Order > > > > I've mapped the read-only relationship "orderHistory" from Customer > to > > Order. > > > > Now I'd like to perform two queries. One for customers with orders > > and > > one for customers without. I'd rather not filter in the app itself > > because I'd like to paginate the result lists. > > > > Is there a way to do this without resulting to an SQLTemplate query? > > > > Thanks, > > Kevin > > > > -- > > Kevin Menard > > Servprise International, Inc. > > Remote reboot & power control for your network > > www.servprise.com +1 508.892.3823 x308 > > > > > >