Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 31782 invoked from network); 17 Oct 2007 22:05:39 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 17 Oct 2007 22:05:39 -0000 Received: (qmail 6606 invoked by uid 500); 17 Oct 2007 22:05:26 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 6568 invoked by uid 500); 17 Oct 2007 22:05:26 -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 6559 invoked by uid 99); 17 Oct 2007 22:05:26 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Oct 2007 15:05:26 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of plinskey@gmail.com designates 64.233.170.190 as permitted sender) Received: from [64.233.170.190] (HELO rn-out-0102.google.com) (64.233.170.190) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Oct 2007 22:05:30 +0000 Received: by rn-out-0102.google.com with SMTP id s42so421201rnb for ; Wed, 17 Oct 2007 15:05:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=15e9NaEcpv9pFNRm7TkCvjCGE6nCTZMfAp2mQJt9eNQ=; b=ZDYGFvGVwluShD7V913nZu1pyAJsa1NPbEuHXKf+axqWg81NvGwkY48/haUQcmd5K+wzcc8kbgwTYAucxuaM3E+8M/mUvQ1jYrl8+iUL33lqo3igyuj0oEPVRUn5eDLfDJkmQP90ai6rLcvRLPzMuSejoCxWpKqyi4PQmyVI22g= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=Z06dpUbjMiREUM7T+qg1cj9m9XSx2HgggMtkM4zWUj4I6RTPbESgAehkOPwDeS8APV370m/sARYRBd4r2WgnlRWqCtVKrqeYXlphd5PQEegeCgxwUmMflXRptvTGNk4NgkLmRYPy5nQk088b3sF4nNoXdFO783DQHygdcPjQ7r0= Received: by 10.143.8.10 with SMTP id l10mr2887390wfi.1192658707012; Wed, 17 Oct 2007 15:05:07 -0700 (PDT) Received: by 10.143.165.19 with HTTP; Wed, 17 Oct 2007 15:05:06 -0700 (PDT) Message-ID: <7262f25e0710171505x3eadb65eq28952b9f6551bef0@mail.gmail.com> Date: Wed, 17 Oct 2007 15:05:06 -0700 From: "Patrick Linskey" To: dev@openjpa.apache.org Subject: Re: error message for native sql parameters In-Reply-To: <89c0c52c0710170929vadb96bpcb9104e3c1889abc@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <89c0c52c0710170929vadb96bpcb9104e3c1889abc@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org Sounds like a good solution to me. -Patrick On 10/17/07, Kevin Sutter wrote: > Hi, > One of our customers stumbled over this error message when parsing a > @NamedNativeQuery: > > bad-param-name: The parameter name or position "{0}" passed to \ > execute() is not valid. All map keys must be a declared parameter \ > name or a number matching the parameter position. > > The @NamedNativeQuery was as follows: > > @NamedNativeQuery(name="getStationKeyForUpdate", > query="SELECT * from KEYGEN where KEYNAME = :keyname FOR UPDATE") > > Native Queries only allow positional parameters. This customer thought that > the error message should be clearer since it mentions that named parameters > may also be allowed. > > I looked at the code in question and we use the same processing for named > and positional parameter for both jpql and native queries. So, it would be > overkill (in my mind) to separate out the processing just to clarify the > syntax requirements of the various queries. > > So, would there be any problem with just adding the following to the error > message: > > bad-param-name: The parameter name or position "{0}" passed to \ > execute() is not valid. All map keys must be a declared parameter \ > name or a number matching the parameter position. Native queries \ > only allow positional parameters. > > It clarifies the problem without introducing a lot of extra processing. > > Kevin > -- Patrick Linskey 202 669 5907