Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 91523 invoked from network); 1 Sep 2008 00:00:05 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 1 Sep 2008 00:00:05 -0000 Received: (qmail 5872 invoked by uid 500); 1 Sep 2008 00:00:03 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 5848 invoked by uid 500); 1 Sep 2008 00:00:03 -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 5837 invoked by uid 99); 1 Sep 2008 00:00:03 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 31 Aug 2008 17:00:03 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 31 Aug 2008 23:59:13 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 2F1F1234C1B8 for ; Sun, 31 Aug 2008 16:59:44 -0700 (PDT) Message-ID: <1815328657.1220227184191.JavaMail.jira@brutus> Date: Sun, 31 Aug 2008 16:59:44 -0700 (PDT) From: "Catalina Wei (JIRA)" To: dev@openjpa.apache.org Subject: [jira] Updated: (OPENJPA-708) sub-sub-query generates SQL with syntax error In-Reply-To: <541868651.1220225385259.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/OPENJPA-708?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Catalina Wei updated OPENJPA-708: --------------------------------- Affects Version/s: 1.3.0 1.2.1 1.0.4 1.0.3 > sub-sub-query generates SQL with syntax error > --------------------------------------------- > > Key: OPENJPA-708 > URL: https://issues.apache.org/jira/browse/OPENJPA-708 > Project: OpenJPA > Issue Type: Sub-task > Components: jdbc > Affects Versions: 1.0.3, 1.0.4, 1.2.0, 1.2.1, 1.3.0 > Reporter: Catalina Wei > Assignee: Catalina Wei > Fix For: 1.3.0 > > > SELECT p, m > FROM Publisher p > LEFT OUTER JOIN p.magazineCollection m > WHERE m.id = (SELECT MAX(m2.id) > FROM Magazine m2 > WHERE m2.idPublisher.id = p.id > AND m2.datePublished = > (SELECT MAX(m3.datePublished) > FROM Magazine m3 > WHERE m3.idPublisher.id = p.id)) > OpenJPA 1.2.0 translates this into native (MySQL) query: > SELECT t0.id, t1.id, t1.date_published, t1.id_publisher, t1.name > FROM Publisher t0 > LEFT OUTER JOIN Magazine t1 > ON t0.id = t1.id_publisher > WHERE (t1.id = (SELECT MAX(t4.id) > FROM Magazine t4 > WHERE (t2.id_publisher = t0.id > AND t2.date_published = > (SELECT MAX(t3.date_published) > FROM Magazine t2, Magazine t3 > WHERE (t3.id_publisher = t0.id))))) > and that query throws an exception: > NestedThrowables: > com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Unknown column 't2.id_publisher' in 'where clause' -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.