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;

 

<openjpa-1.2.1-r752877:753278 nonfatal user error>
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:[email protected]] 
Sent: Saturday, 20 February 2010 12:56 AM
To: [email protected]; [email protected]
Subject: Re: Query confusion

 

 

On Fri, Feb 19, 2010 at 8:46 AM, C N Davies <[email protected]> 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:[email protected]

Reply via email to