persistence@glassfish.java.net

Query is crashing -- but why?

From: Markus Karg <karg_at_quipsy.de>
Date: Mon, 25 Aug 2008 17:00:48 +0200

In SQL, I can run the following query on my database:

SELECT A.x, COUNT(DISTINCT B.y) FROM B LEFT JOIN A GROUP BY A.x

and get the expected result.

Now I want to do the same in JPA:

SELECT a.x, COUNT(DISTINCT b.y) FROM B b LEFT JOIN b.as a GROUP BY a.x

But it results in an exception:

"The query has not been defined correctly, the expression builder is
missing. For sub and parallel queries ensure the queries builder is
always on the left."

What is may failure?

How to correct it?

Thanks!
Markus