Return-Path: Delivered-To: apmail-openjpa-users-archive@minotaur.apache.org Received: (qmail 62277 invoked from network); 15 Jul 2010 21:41:52 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 15 Jul 2010 21:41:52 -0000 Received: (qmail 80673 invoked by uid 500); 15 Jul 2010 21:41:52 -0000 Delivered-To: apmail-openjpa-users-archive@openjpa.apache.org Received: (qmail 80633 invoked by uid 500); 15 Jul 2010 21:41:51 -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 80625 invoked by uid 99); 15 Jul 2010 21:41:51 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Jul 2010 21:41:51 +0000 X-ASF-Spam-Status: No, hits=1.3 required=10.0 tests=SPF_PASS,URI_HEX X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [74.115.64.214] (HELO smtp.mclaneat.com) (74.115.64.214) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Jul 2010 21:41:45 +0000 Received: from MATSVEC14.mclane.local ([192.168.10.33]) by MATSVEHT12.mclane.local ([192.168.10.36]) with mapi; Thu, 15 Jul 2010 16:41:24 -0500 From: Russell Collins To: "'users@openjpa.apache.org'" Date: Thu, 15 Jul 2010 16:41:09 -0500 Subject: RE: Unnecesery INNER JOIN Thread-Topic: Unnecesery INNER JOIN Thread-Index: AcskPOVgPQ9rRqX2ST6I3fThAbHfBQAKRz4A Message-ID: <69BEFCE5AAEBCA44B1301AD2360E83C7BEA00953EB@MATSVEC14.mclane.local> References: <1279199947537-5297321.post@n2.nabble.com> In-Reply-To: <1279199947537-5297321.post@n2.nabble.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Virus-Checked: Checked by ClamAV on apache.org >From the looks of what you have in your query, there has to be a join of so= me kind. You are trying to get the "id" of class "A" that is associated wi= th class "B". If this is not your desire, what are you trying to do? -----Original Message----- From: QkI [mailto:kukismen@gmail.com] Sent: Thursday, July 15, 2010 8:19 AM To: users@openjpa.apache.org Subject: Unnecesery INNER JOIN Hi, Let's say I have the following persistence class: @Entity public class B { @OneToOne(cascade =3D CascadeType.PERSIST, fetch =3D FetchType.LAZY) @JoinColumn(name =3D "a_id") private A a; } and when I try to execute this JPA query: SELECT b.a.id FROM B where B.id =3D 123 my SQL output looks like: SELECT t1.id FROM table_b t0 INNER JOIN table_a t1 ON t0.a_id =3D t1.id WHE= RE (t0.id =3D 123) Why does openJPA add unnecesery JOIN to the SQL query. Can I somehow change this behaviour of openJPA Thanks, QkI -- View this message in context: http://openjpa.208410.n2.nabble.com/Unneceser= y-INNER-JOIN-tp5297321p5297321.html Sent from the OpenJPA Users mailing list archive at Nabble.com. CONFIDENTIALITY NOTICE: The information contained in this electronic mail (= email) transmission (including attachments), is intended by MCLANE ADVANCED= TECHNOLOGIES for the use of the named individual or entity to which it is = addressed and may contain information that is privileged, confidential and/= or protected as a trade secret. It is not intended for transmission to, or = receipt by, any individual or entity other than the named addressee(s). If = you have received this email in error, please delete it (including attachme= nts) and any copies thereof without printing, copying or forwarding it, and= notify the sender of the error by email reply immediately.