Return-Path: X-Original-To: apmail-openjpa-dev-archive@www.apache.org Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 16BCCFF09 for ; Wed, 10 Apr 2013 14:16:16 +0000 (UTC) Received: (qmail 92614 invoked by uid 500); 10 Apr 2013 14:16:15 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 92587 invoked by uid 500); 10 Apr 2013 14:16:15 -0000 Mailing-List: contact dev-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openjpa.apache.org Delivered-To: mailing list dev@openjpa.apache.org Received: (qmail 92577 invoked by uid 99); 10 Apr 2013 14:16:15 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 Apr 2013 14:16:15 +0000 Date: Wed, 10 Apr 2013 14:16:15 +0000 (UTC) From: "Albert Lee (JIRA)" To: dev@openjpa.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (OPENJPA-2289) Additional SQL alias generated for query with subquery causes incorrect # of rows returned - Oracle only MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/OPENJPA-2289?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Albert Lee updated OPENJPA-2289: -------------------------------- Fix Version/s: 2.2.1.1 2.2.2 2.3.0 2.1.2 2.0.3 > Additional SQL alias generated for query with subquery causes incorrect # of rows returned - Oracle only > -------------------------------------------------------------------------------------------------------- > > Key: OPENJPA-2289 > URL: https://issues.apache.org/jira/browse/OPENJPA-2289 > Project: OpenJPA > Issue Type: Bug > Components: sql > Affects Versions: 2.0.1, 2.1.1, 2.2.0, 2.3.0 > Reporter: Albert Lee > Assignee: Albert Lee > Fix For: 2.0.3, 2.1.2, 2.3.0, 2.2.2, 2.2.1.1 > > Attachments: OPENJPA-2289.20x.patch > > > .createQuery("SELECT e FROM MaxQueryEntity e, MaxQueryMapEntity map " > + "WHERE map.selectCriteria = 'B3' AND map.refEntity = e " > + " AND e.revision = ( SELECT MAX(e_.revision)" > + " FROM MaxQueryEntity e_" > + " WHERE e_.domainId = e.domainId )" > + " AND map.revision = ( SELECT MAX(map_.revision)" > + " FROM MaxQueryMapEntity map_" > + " WHERE map_.refEntity = map.refEntity )"); > On Oracle we generate SQL like this on 2.0.x+: > SELECT t1.id, t1.domainId, t1.revision FROM OPENJPA_MAXQUERY_MAPENTITY t0, OPENJPA_MAXQUERY_ENTITY t1, OPENJPA_MAXQUERY_MAPENTITY t4 WHERE (t0.selectCriteria = ? AND t0.refEntity = t1.id AND t1.revision = (SELECT MAX(t2.revision) FROM OPENJPA_MAXQUERY_ENTITY t2 WHERE (t2.domainId = t1.domainId)) AND t0.revision = (SELECT MAX(t3.revision) FROM OPENJPA_MAXQUERY_MAPENTITY t3 WHERE (t3.refEntity = t4.refEntity))) [params=(String) B3] > The additional alias "OPENJPA_MAXQUERY_MAPENTITY t4" caused more unexpected rows to return. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira