Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 910 invoked from network); 4 Jan 2011 18:27:11 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 4 Jan 2011 18:27:11 -0000 Received: (qmail 7706 invoked by uid 500); 4 Jan 2011 18:27:11 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 7650 invoked by uid 500); 4 Jan 2011 18:27:11 -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 7581 invoked by uid 99); 4 Jan 2011 18:27:11 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Jan 2011 18:27:11 +0000 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.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Jan 2011 18:27:09 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id p04IQlHk008672 for ; Tue, 4 Jan 2011 18:26:47 GMT Message-ID: <21976961.138831294165607458.JavaMail.jira@thor> Date: Tue, 4 Jan 2011 13:26:47 -0500 (EST) From: "Fay Wang (JIRA)" To: dev@openjpa.apache.org Subject: [jira] Commented: (OPENJPA-1914) Issue with OpenJPA 1.2.1 while using subquery. In-Reply-To: <22889028.130181294135545173.JavaMail.jira@thor> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/OPENJPA-1914?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12977392#action_12977392 ] Fay Wang commented on OPENJPA-1914: ----------------------------------- According to the spec, the BNF of the in_expression, subquery are: in_expression ::= state_field_path_expression [NOT] IN ( in_item {, in_item}* | subquery) subquery ::= simple_select_clause subquery_from_clause [where_clause][groupby_clause] [having_clause] simple_select_clause ::= SELECT [DISTINCT] simple_select_expression As can be seen from the BNF, the LHS of the in_expression can be one and only one path expression and the subquery can select one and only one expression or variable. The where clause in your JPQL, therefore, is incorrect: WHERE (jrNbr.countryCode,jrNbr.sourceCode) NOT IN (SELECT vNbr.countryCode,vNbr.sourceCode FROM VoucherNumber vNbr,Country ctyEntity WHERE vNbr.countryCode = ctyEntity.cty AND ctyEntity.cln_identity=:clnIdentity)"; > Issue with OpenJPA 1.2.1 while using subquery. > ---------------------------------------------- > > Key: OPENJPA-1914 > URL: https://issues.apache.org/jira/browse/OPENJPA-1914 > Project: OpenJPA > Issue Type: Bug > Affects Versions: 1.2.1 > Environment: Database server = DB2 z/OS 9.1.5 in AIX system. Working from standalone java program. using log4j-1.2.14.jar and geronimo-jpa_3.0_spec-1.0.jar > Reporter: JaiKumar > > On using below code to update an JournalNumber entity .. > tx = entityManager.getTransaction(); > tx.begin(); > System.out.println("...Clone :" + cloneId); > String query = "UPDATE JournalNumber jrNbr SET jrNbr.updated_on=:updatedOn WHERE (jrNbr.countryCode,jrNbr.sourceCode) NOT IN(SELECT vNbr.countryCode,vNbr.sourceCode FROM VoucherNumber vNbr,Country ctyEntity WHERE vNbr.countryCode = ctyEntity.cty AND ctyEntity.cln_identity=:clnIdentity)"; > Query q = entityManager.createQuery(query); > q.setParameter("updatedOn", new Date()); > q.setParameter("clnIdentity", cloneId); > q.executeUpdate(); > tx.commit(); > I get below error .. > org.apache.openjpa.persistence.ArgumentException: Encountered "jrNbr . countryCode ," at character 67, but expected: ["(", ")", "*", "+", "-", ".", "/", ":", "<", "<=", "<>", "=", ">", ">=", "?", "ABS", "ALL", "AND", "ANY", "AS", "ASC", "AVG", "BETWEEN", "BOTH", "BY", "CONCAT", "COUNT", "CURRENT_DATE", "CURRENT_TIME", "CURRENT_TIMESTAMP", "DELETE", "DESC", "DISTINCT", "EMPTY", "ESCAPE", "EXISTS", "FETCH", "FROM", "GROUP", "HAVING", "IN", "INNER", "IS", "JOIN", "LEADING", "LEFT", "LENGTH", "LIKE", "LOCATE", "LOWER", "MAX", "MEMBER", "MIN", "MOD", "NEW", "NOT", "NULL", "OBJECT", "OF", "OR", "ORDER", "OUTER", "SELECT", "SET", "SIZE", "SOME", "SQRT", "SUBSTRING", "SUM", "TRAILING", "TRIM", "UPDATE", "UPPER", "WHERE", , , , ]. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.