openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Patrick Linskey" <plins...@gmail.com>
Subject Re: JPQL query not working..?
Date Tue, 01 Apr 2008 15:47:22 GMT
>  Im a newcommer both to JPA and OpenJPA. I've used hibernate previously
>  as a provider, but found their error messages lacking a lot (almost
>  impossible to work with). OpenJPA are how it's supposed to be:) Now you
>  only need a criteria api like hibernates:)

Have you looked at Quare [1]?

>  Are there something visibly wrong with those queries? I have a couple of
>  other there are working just fine, but it seems as when I go deeper than
>  1 relation it does not work?

Can you post the generated SQL?

-Patrick

[1] http://quaere.codehaus.org/

On Tue, Apr 1, 2008 at 5:10 AM, Nino Saturnino Martinez Vazquez Wael
<nino.martinez@jayway.dk> wrote:
> Hi
>
>  Im a newcommer both to JPA and OpenJPA. I've used hibernate previously
>  as a provider, but found their error messages lacking a lot (almost
>  impossible to work with). OpenJPA are how it's supposed to be:) Now you
>  only need a criteria api like hibernates:)
>
>  However I have a JPQL query which doesnt seem to work as I want. In my
>  project I have a Person which haves some trainingSchemes, these
>  trainingSchemes has trainingSets and a trainingSet has a exercise. So I
>  want a query which returns only persons with a certain exercise, I've
>  tried it a dozen ways now. But the result are always the same I get all
>  Persons in the database(I actually got the same result in hibernate
>  using their criteria api) even though they do not have the exercise i
>  query for. Now heres my 2 latest tries:
>
>
>     * SELECT DISTINCT p FROM Person p, IN(p.trainingSchemes)
>       ts,IN(ts.trainingSets) tset, IN(tset.exercise) ex where ex.id IN
>       (someints)
>     * SELECT DISTINCT p FROM Person as p INNER JOIN p.trainingSchemes as
>       tscheme INNER JOIN tscheme.trainingSets as tset where
>       tset.exercise.id IN(someints)
>
>  Are there something visibly wrong with those queries? I have a couple of
>  other there are working just fine, but it seems as when I go deeper than
>  1 relation it does not work?
>
>  --
>  -Wicket for love
>
>  Nino Martinez Wael
>  Java Specialist @ Jayway DK
>  http://www.jayway.dk
>  +45 2936 7684
>
>



-- 
Patrick Linskey
202 669 5907

Mime
View raw message