db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig L Russell <Craig.Russ...@Sun.COM>
Subject Re: Subquery
Date Fri, 26 Oct 2007 18:19:06 GMT
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!


Mime
View raw message