Return-Path: Delivered-To: apmail-incubator-open-jpa-dev-archive@locus.apache.org Received: (qmail 54743 invoked from network); 25 Jan 2007 01:32:10 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 25 Jan 2007 01:32:10 -0000 Received: (qmail 98677 invoked by uid 500); 25 Jan 2007 01:32:16 -0000 Delivered-To: apmail-incubator-open-jpa-dev-archive@incubator.apache.org Received: (qmail 98577 invoked by uid 500); 25 Jan 2007 01:32:16 -0000 Mailing-List: contact open-jpa-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: open-jpa-dev@incubator.apache.org Delivered-To: mailing list open-jpa-dev@incubator.apache.org Received: (qmail 98568 invoked by uid 99); 25 Jan 2007 01:32:16 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 Jan 2007 17:32:16 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 Jan 2007 17:32:09 -0800 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 108A27141A3 for ; Wed, 24 Jan 2007 17:31:49 -0800 (PST) Message-ID: <25638066.1169688709048.JavaMail.jira@brutus> Date: Wed, 24 Jan 2007 17:31:49 -0800 (PST) From: "Marc Prud'hommeaux (JIRA)" To: open-jpa-dev@incubator.apache.org Subject: [jira] Resolved: (OPENJPA-111) native queries fail when use named parameters In-Reply-To: <18027360.1169688349048.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-111?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Marc Prud'hommeaux resolved OPENJPA-111. ---------------------------------------- Resolution: Invalid Section 3.6.3 of the JPA spec: "Only positional parameter binding may be portably used for native queries." > native queries fail when use named parameters > --------------------------------------------- > > Key: OPENJPA-111 > URL: https://issues.apache.org/jira/browse/OPENJPA-111 > Project: OpenJPA > Issue Type: Bug > Environment: windows xp, openjpa_097_incubating > Reporter: George Hongell > > native queries fail when use named parameters > int parm3 = 100; > String sql = "SELECT deptno,budget,NAME,MGR_EMPID,REPORTSTO_DEPTNO FROM DeptBean WHERE deptno >= :deptno "; > Query getDept = _em.createNativeQuery(sql,DeptBean.class > getDept.setParameter("deptno",parm3); > List rl = (getDept.getResultList()); > <4|false|0.9.7-incubating-SNAPSHOT> org.apache.openjpa.persistence.ArgumentException: The parameter name or position "deptno" passed to execute() is not valid. All map keys must be a declared parameter name or a number matching the parameter position. > at org.apache.openjpa.kernel.QueryImpl.toParameterArray(QueryImpl.java:897) > at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:825) > at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:763) > at org.apache.openjpa.kernel.DelegatingQuery.execute(DelegatingQuery.java:520) > at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:224) > at org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:264) > at com.ibm.ws.query.tests.JUNamedNativeQueryTest.testSelectDeptBean2(JUNamedNativeQueryTest.java:514) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:615) > at junit.framework.TestCase.runTest(Unknown Source) > at junit.framework.TestCase.runBare(Unknown Source) > at junit.framework.TestResult$1.protect(Unknown Source) > at junit.framework.TestResult.runProtected(Unknown Source) > at junit.framework.TestResult.run(Unknown Source) > at junit.framework.TestCase.run(Unknown Source) > at junit.framework.TestSuite.runTest(Unknown Source) > at junit.framework.TestSuite.run(Unknown Source) > at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478) > at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344) > at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.