users@glassfish.java.net

Any way to do this in Toplink Expression Builder?

From: <glassfish_at_javadesktop.org>
Date: Wed, 09 Apr 2008 12:02:09 PDT

Basically, we have a Parent-Child relationship between two tables.

And we want to get all of the parents that have a set of child rows.


In SQL (one way) to do it is like this:

select * from parent p where p.parentid in (
   select c1.parentid from child c1, child c2
   where c1.property='firstprop'
   and c1.value='firstvalue'
   and c1.parentid=c2.parentid
   and c2.property='secondprop'
   and c2.value='secondvalue'
 )

I'm curious how this would be expressed using the Toplink Expression Builder.
[Message sent by forum member 'whartung' (whartung)]

http://forums.java.net/jive/thread.jspa?messageID=268414