openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "C N Davies" <>
Subject RE: Query confusion
Date Tue, 23 Feb 2010 02:49:34 GMT
Hi Kevin,


I can't find it in the Jira, but I added a comment on last Saturday, I
downloaded the patched version
apache-openjpa-2.0.0-beta\openjpa-all-2.0.0-svn-910423.jar to fix the issue
however it did not fix the other issue of being able to use "+" symbol in my





From: Kevin Sutter [] 
Sent: Tuesday, 23 February 2010 1:19 AM
Subject: Re: Query confusion


Hi Chris,
Which classloader issue are you referring to?  


On Sat, Feb 20, 2010 at 5:49 AM, C N Davies <> wrote:

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!



From: catalina wei []
Sent: Saturday, 20 February 2010 10:33 PM

Subject: Re: Query confusion

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
Could you try any OpenJPA 2.0.x releases ?


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

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"].


What is wrong with my "*" symbol? It is documented as supported.

I tried like this:

(sum(dl.bwCount) * dl.bwRate)

Same issue L



From: Daryl Stultz []
Sent: Saturday, 20 February 2010 12:56 AM
Subject: Re: Query confusion

On Fri, Feb 19, 2010 at 8:46 AM, C N Davies <> wrote:


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.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.


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message