Hi,
I am using the following OpenJPA version in an Eclipse RCP app:
   OpenJPA 1.2.1
   version id: openjpa-1.2.1-r2180:4612

I receive errors when using aliases in a select statement:

Example:
 select s.name, count(distinct g) as c from Systems s, IN(s.groups) g group
by s.name order by c

Error msg:
 Encountered "as" at character 34, but expected: [",", "FROM"].by c"

When I drop the alias and order by the count, as in the following example,

 select s.name, count(distinct g) from Systems s, IN(s.groups) g group by
s.name order by count(g)

 the query is executed but the result is not ordered properly. Is this due
to the use of "distinct" in the query, but not the ORDER? According to the
query syntax, "distinct" cannot be used with ORDER.

Is the use of aliases in the select as I describe here part of JPA 2.0 and
therefore not supported in my OpenJPA 1.2.1?
If so, what any suggestions on how to order on count of a distinct
attribute?

Thanks,
 Chris




Reply via email to