db-jdo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig L Russell <Craig.Russ...@Sun.COM>
Subject Re: Need help with query to select items through maps and sets
Date Sun, 17 Dec 2006 01:37:48 GMT
Hi Neil,

The query looks fine to me. You probably should post this question on  
the JPOX.org forum as well.

Regards,

Craig

On Dec 16, 2006, at 12:39 PM, Neil Aggarwal wrote:

> Hello:
>
> I am using JDO 2 (The JPOX implementation).
>
> I have four related persistent classes:
> Product - contains a qtyAvailable for the quantity we can sell
> Subclass - has a set of products
> ClassNode - has a map of String to Subclass objects
> Department - has a map of String to ClassNode objects.
>
> I want to get all of the products that are contained in
> a department, so I wrote the query below.  Unfortunately,
> it is giving me zero results.
>
> Here is the code I am using:
>
> Query q = pm.newQuery(Product.class);
> q.declareImports("import persistent.*");
> q.declareParameters("Department d");
> q.declareVariables("ClassNode c; Subclass s; Product p");
> q.setFilter("d.classesMap.containsValue(c) &&  
> c.subclassMap.containsValue(s)
> && s.products.contains(p) && (p.qtyAvailable>0)");
> Collection result = (Collection) q.execute(dept);
>
> Did I do something wrong in my query?
>
> Thanks,
> Neil
>
>
> --
> Neil Aggarwal, (214)986-3533, www.JAMMConsulting.com
> FREE! Eliminate junk email and reclaim your inbox.
> Visit http://www.spammilter.com for details.
>

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