Return-Path: Delivered-To: apmail-openjpa-users-archive@locus.apache.org Received: (qmail 95365 invoked from network); 12 Dec 2007 16:33:45 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 12 Dec 2007 16:33:45 -0000 Received: (qmail 90434 invoked by uid 500); 12 Dec 2007 16:33:34 -0000 Delivered-To: apmail-openjpa-users-archive@openjpa.apache.org Received: (qmail 90416 invoked by uid 500); 12 Dec 2007 16:33:34 -0000 Mailing-List: contact users-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@openjpa.apache.org Delivered-To: mailing list users@openjpa.apache.org Received: (qmail 90407 invoked by uid 99); 12 Dec 2007 16:33:34 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 12 Dec 2007 08:33:34 -0800 X-ASF-Spam-Status: No, hits=0.2 required=10.0 tests=SPF_PASS,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of tylercoles@gmail.com designates 209.85.198.187 as permitted sender) Received: from [209.85.198.187] (HELO rv-out-0910.google.com) (209.85.198.187) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 12 Dec 2007 16:33:12 +0000 Received: by rv-out-0910.google.com with SMTP id k20so233830rvb.33 for ; Wed, 12 Dec 2007 08:33:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; 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=nETom3rZcnqY7KP62K1JxK/Cbryz1HYF6C2AV4NKeQk=; b=bMeaZ07rrmcojlL0w16Oo1Ldenz2xxqGQbtYn+R7GlC7gtYHaiGUkTksuS+UjLcKKTlI7JT5looMXVwv671dK1yxGUqmxV6D3zNYe6gMS4DVMeE/dzB+ZVXAbQzGXg7e7FgWeSXmUUE/enZCZ9NOAFMK655KJqjFBVf3O1u4TMY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=nYlCKt2HWkiwpBqXlU1vPORPHI/iYWfLLZJd53GvWr4pl1SyyyD+3D+0WMzdc63qHQC2FFE+simMGZWnfuqgXJAU0PFWajH3JVF5kv52mc4fZUHK0XAJWGifPNIvcS+hOEZv3E8e4PK3nIvNVa5NFV+BApvQ5Bd4XHc0i3C9Mv4= Received: by 10.141.29.18 with SMTP id g18mr444871rvj.298.1197477193295; Wed, 12 Dec 2007 08:33:13 -0800 (PST) Received: by 10.140.162.8 with HTTP; Wed, 12 Dec 2007 08:33:13 -0800 (PST) Message-ID: <51b69aab0712120833k770820bcjcabb0f506a15d293@mail.gmail.com> Date: Wed, 12 Dec 2007 09:33:13 -0700 From: "Tyler Coles" To: users@openjpa.apache.org Subject: Re: org.apache.openjpa.persistence.ArgumentException: -1 In-Reply-To: <14286888.post@talk.nabble.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <14286888.post@talk.nabble.com> X-Virus-Checked: Checked by ClamAV on apache.org Well I'm not an expert, but it appears as though you shouldn't be using getSingleResult(), since your query does not inherently guarantee that a single result will be returned. If you check the javax.persistence.Query JavaDoc, getSingleResult() is supposed to throw an exception if more than one row results from a query. I don't know why OpenJPA complains about argument, looks counter-intuitive to me: Average Joe User. I would try getResultList().get(0) if you know for certain that there is only one row whose parent is null (which I'm sure makes sense in your application). Maybe someone can comment as to whether the exception should be more precise. Tyler On Dec 11, 2007 5:45 PM, roger.keays wrote: > > > Does anybody recognise this error in openjpa 1.0.0? > > > org.apache.openjpa.persistence.ArgumentException: -1 > org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:808) > org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:769) > org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:765) > org.apache.openjpa.kernel.DelegatingQuery.execute(DelegatingQuery.java:517) > org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:238) > > org.apache.openjpa.persistence.QueryImpl.getSingleResult(QueryImpl.java:300) > figbird.cms.application.CMS.getRootItem(CMS.java:249) > > The query is: > > query = em.createQuery("SELECT item FROM Page item WHERE " + > "item.parent is null"); > try { > root = (Page) query.getSingleResult(); > } > > If I enhance with 1.0.1 and deploy with 1.0.0 it works without error. > > Thanks in advance, > > Roger > -- > View this message in context: http://www.nabble.com/org.apache.openjpa.persistence.ArgumentException%3A--1-tp14286888p14286888.html > Sent from the OpenJPA Users mailing list archive at Nabble.com. > >