You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Marc Logemann <ml...@logemann.org> on 2008/08/06 15:10:22 UTC
searching in double nested list
HI,
i know that i can entities in relations like this:
SELECT x FROM Magazine x, IN(x.articles) y WHERE y.authorName = 'John
Doe'
But what if i have this objectmodel:
Magazine->Articles->Paragraphs
And now i want to query for paragraph.number = 2 ???
Your example works with a one level nested relation but i have two
levels.
Thanks for ideas.
--
Marc Logemann
blog http://logemannreloaded.blogspot.com
privat http://www.logemann.org
Re: searching in double nested list
Posted by Jeremy Bauer <te...@gmail.com>.
Marc,
If I correctly understand the result you seek, you need to do a three
way join across the entities. The JPQL below may be what you need (or
close to it). The IN() join syntax may also work, but I haven't tried
it.
"SELECT z FROM Magazine x JOIN x.articles y JOIN y.paragraph z where
y.authorName = 'John Doe' AND z.number = 2"
-Jeremy