Return-Path: Delivered-To: apmail-openjpa-users-archive@minotaur.apache.org Received: (qmail 3272 invoked from network); 1 Jun 2010 16:14:50 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 1 Jun 2010 16:14:50 -0000 Received: (qmail 48467 invoked by uid 500); 1 Jun 2010 16:14:50 -0000 Delivered-To: apmail-openjpa-users-archive@openjpa.apache.org Received: (qmail 48422 invoked by uid 500); 1 Jun 2010 16:14:50 -0000 Mailing-List: contact users-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@openjpa.apache.org Delivered-To: mailing list users@openjpa.apache.org Received: (qmail 48414 invoked by uid 99); 1 Jun 2010 16:14:50 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Jun 2010 16:14:50 +0000 X-ASF-Spam-Status: No, hits=-2.3 required=10.0 tests=RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [216.82.241.147] (HELO mail146.messagelabs.com) (216.82.241.147) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Jun 2010 16:14:39 +0000 X-VirusChecked: Checked X-Env-Sender: dk068x@att.com X-Msg-Ref: server-5.tower-146.messagelabs.com!1275408857!26912227!1 X-StarScan-Version: 6.2.4; banners=-,-,- X-Originating-IP: [144.160.112.25] Received: (qmail 19904 invoked from network); 1 Jun 2010 16:14:17 -0000 Received: from sbcsmtp3.sbc.com (HELO tlph064.enaf.dadc.sbc.com) (144.160.112.25) by server-5.tower-146.messagelabs.com with DHE-RSA-AES256-SHA encrypted SMTP; 1 Jun 2010 16:14:17 -0000 Received: from enaf.dadc.sbc.com (localhost.localdomain [127.0.0.1]) by tlph064.enaf.dadc.sbc.com (8.14.3/8.14.3) with ESMTP id o51GEG30014173 for ; Tue, 1 Jun 2010 11:14:17 -0500 Received: from td03xsmtp005.US.Cingular.Net (td03xspare20-new.us.cingular.net [135.179.64.44] (may be forged)) by tlph064.enaf.dadc.sbc.com (8.14.3/8.14.3) with ESMTP id o51GEBon013914 for ; Tue, 1 Jun 2010 11:14:11 -0500 Received: from bd01xsmtp004.US.Cingular.Net ([135.163.18.45]) by td03xsmtp005.US.Cingular.Net with Microsoft SMTPSVC(6.0.3790.4675); Tue, 1 Jun 2010 11:14:10 -0500 Received: from BD01MSXMB018.US.Cingular.Net ([135.214.27.52]) by bd01xsmtp004.US.Cingular.Net with Microsoft SMTPSVC(6.0.3790.4675); Tue, 1 Jun 2010 09:14:10 -0700 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: Query for union of child list Date: Tue, 1 Jun 2010 09:14:09 -0700 Message-ID: In-Reply-To: <1275408055717-5126735.post@n2.nabble.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Query for union of child list Thread-Index: AcsBo7aXDx8TO7T1SmiHQbCp3sto0QAAaS/g References: <1275408055717-5126735.post@n2.nabble.com> From: "KARR, DAVID (ATTSI)" To: X-OriginalArrivalTime: 01 Jun 2010 16:14:10.0224 (UTC) FILETIME=[77DAA300:01CB01A5] X-Virus-Checked: Checked by ClamAV on apache.org > -----Original Message----- > From: Pinaki Poddar [mailto:ppoddar@apache.org] > Sent: Tuesday, June 01, 2010 9:01 AM > To: users@openjpa.apache.org > Subject: Re: Query for union of child list >=20 >=20 > > I need to get a list of all the unique "Foo" objects in the > "childFoos" > list for all "Device" objects. >=20 > JPA 2.0 introduced a new entity type expression for JPQL which may be > useful here. > I will expect something like (provided Product-Foo is a bi- > directional > relation) >=20 > String jpql =3D "select f from Foo f where f.parent =3D :subtype"; > em.createQuery(jpql) > .setParameter("subtype", Device.class) > .getResultList(); Unfortunately, I'm limited to OpenJPA 1.x for now. What I have works, I just wanted to know if there was a better way to do it.