Return-Path: Delivered-To: apmail-openjpa-users-archive@minotaur.apache.org Received: (qmail 4899 invoked from network); 20 Feb 2010 11:49:56 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 20 Feb 2010 11:49:56 -0000 Received: (qmail 11459 invoked by uid 500); 20 Feb 2010 11:49:56 -0000 Delivered-To: apmail-openjpa-users-archive@openjpa.apache.org Received: (qmail 11386 invoked by uid 500); 20 Feb 2010 11:49:56 -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 11376 invoked by uid 99); 20 Feb 2010 11:49:56 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 20 Feb 2010 11:49:56 +0000 X-ASF-Spam-Status: No, hits=3.4 required=10.0 tests=HTML_MESSAGE,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [209.85.217.227] (HELO mail-gx0-f227.google.com) (209.85.217.227) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 20 Feb 2010 11:49:47 +0000 Received: by gxk27 with SMTP id 27so1642517gxk.1 for ; Sat, 20 Feb 2010 03:49:26 -0800 (PST) Received: by 10.150.7.16 with SMTP id 16mr3696364ybg.272.1266666566395; Sat, 20 Feb 2010 03:49:26 -0800 (PST) Received: from brevsnb004 (CPE-124-176-102-11.lns4.ken.bigpond.net.au [124.176.102.11]) by mx.google.com with ESMTPS id 5sm527671yxd.35.2010.02.20.03.49.21 (version=SSLv3 cipher=RC4-MD5); Sat, 20 Feb 2010 03:49:24 -0800 (PST) Reply-To: From: "C N Davies" To: "'catalina wei'" , References: <014d01cab169$f43d4920$dcb7db60$@com> <015c01cab203$3f95ac20$bec10460$@com> In-Reply-To: Subject: RE: Query confusion Date: Sat, 20 Feb 2010 22:49:11 +1100 Organization: C N Davies Pty Ltd Message-ID: <000301cab222$bb64fb70$322ef250$@com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0004_01CAB27E.EED57370" X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AcqyIG4jEbKa8mdFRmS/YXUV+GywYwAAIDbw Content-Language: en-au ------=_NextPart_000_0004_01CAB27E.EED57370 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Thanks for the info Catalina, I would like to switch to OpenJPA 2.0 Beta but I hit one of the open issues regarding the class loader. So I'm stuck! Thanks Chris From: catalina wei [mailto:catalina.wei@gmail.com] Sent: Saturday, 20 February 2010 10:33 PM To: users@openjpa.apache.org; cnd@cndavies.com Subject: Re: Query confusion Chris, sum(dl.bwCount) * dl.bwRate is a scalar expression. In Java Persistence 1.0 spec, scalar expression is not allowed to appear as a select item. That is why you are getting a syntax error. JPQL in Java Persistence 2.0 spec has updated the syntax and the scalar expression can be a select item. This support is available in OpenJPA 2.0.x releases. Could you try any OpenJPA 2.0.x releases ? Catalina On Sat, Feb 20, 2010 at 12:03 AM, C N Davies wrote: Thanks Daryl, Pretty obvious, why couldn't I see it! Now I see my next issue, here is my query truncated down to the specific issue: Select sum(dl.bwCount) * dl.bwRate from DLine as dl; org.apache.openjpa.persistence.ArgumentException: Encountered "*" at character 111, but expected: [",", "FROM"]. at org.apache.openjpa.kernel.jpql.JPQL.generateParseException(JPQL.java:9501) What is wrong with my "*" symbol? It is documented as supported. I tried like this: (sum(dl.bwCount) * dl.bwRate) Same issue L Thanks! Chris From: Daryl Stultz [mailto:daryl@6degrees.com] Sent: Saturday, 20 February 2010 12:56 AM To: users@openjpa.apache.org; cnd@cndavies.com Subject: Re: Query confusion On Fri, Feb 19, 2010 at 8:46 AM, C N Davies wrote: Hi, Select Name, Age, EmailAddress, Weight from com.mypackage.User were Age > 25 Using OpenJPA I only know I can query like this: Select u from User where Age > 25 You can do this in JPA QL: select u.name, u.age, u.emailAddress, u.weight from User as u But getResultList() will return a list if User entities, but I only want specific fields as would be returned by my standard SQL above. My above example will return an Object[]. Not especially easy to use, a Map would be nice. But there it is. -- Daryl Stultz _____________________________________ 6 Degrees Software and Consulting, Inc. http://www.6degrees.com mailto:daryl@6degrees.com ------=_NextPart_000_0004_01CAB27E.EED57370--