Patrick Linskey wrote:
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]?
Yeah, but it's pre-beta.. But youre right it looks promising.
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?
Here it are:
executing prepstmnt 12499224 SELECT DISTINCT t0.id, t0.version,
t0.address, t0.alias, t0.birthDate, t0.browser, t0.defaultExerciseType,
t0.email, t0.joined, t0.logins, t0.name, t0.password,
t0.payingUserUntilDate, t0.sexType, t0.userType, t0.validated FROM
PERSON t0 INNER JOIN PERSON_TrainingScheme t1 ON t0.id = t1.PERSON_id
INNER JOIN TrainingScheme t2 ON t1.trainingSchemes_id = t2.id INNER JOIN
TrainingSchemeAbstract t3 ON t2.id = t3.id INNER JOIN TrainingSet t4 ON
t3.id = t4.trainingScheme_id INNER JOIN Exercise t5 ON t4.exercise_id =
t5.id LIMIT ?, ? [params=(long) 0, (long) 40]
So this is the values that I put in, its the two parameters I guess.
search : where ex.id IN (73637,73639)
-Patrick
[1] http://quaere.codehaus.org/
On Tue, Apr 1, 2008 at 5:10 AM, Nino Saturnino Martinez Vazquez Wael
<[EMAIL PROTECTED]> 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
--
-Wicket for love
Nino Martinez Wael
Java Specialist @ Jayway DK
http://www.jayway.dk
+45 2936 7684