You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jdo-dev@db.apache.org by "ganzuoni@objectmagic.org" <ga...@objectmagic.org> on 2007/10/26 17:01:05 UTC
Subquery
There is an old query that it was not possible to express in
JDOQL.
Having A and B classes, with A.b being a many-to-0/1, the
query is:
"What are the Bs not referenced by any A ?".
Does subquery address somehow this use-case too ?
Guido
Re: Subquery
Posted by Craig L Russell <Cr...@Sun.COM>.
Hi Guido,
If there is also a one-to-many on the B side, you can do it in JDO 1.0:
SELECT this FROM B WHERE as.isEmpty().
But if the relationship is only on the many side, you are correct
that JDO 1.0 doesn't have a solution, but JDO 2.1 does:
SELECT this FROM B WHERE !(SELECT DISTINCT this FROM A WHERE b !=
null).contains(this)
The BNF should contain this use pattern.
Regards,
Craig
On Oct 26, 2007, at 8:01 AM, ganzuoni@objectmagic.org wrote:
> There is an old query that it was not possible to express in
> JDOQL.
> Having A and B classes, with A.b being a many-to-0/1, the
> query is:
> "What are the Bs not referenced by any A ?".
> Does subquery address somehow this use-case too ?
>
> Guido
>
Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:Craig.Russell@sun.com
P.S. A good JDO? O, Gasp!