db-jdo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Neil Aggarwal" <n...@JAMMConsulting.com>
Subject Need help with query to select items through maps and sets
Date Sat, 16 Dec 2006 20:39:37 GMT

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?


Neil Aggarwal, (214)986-3533, www.JAMMConsulting.com
FREE! Eliminate junk email and reclaim your inbox.
Visit http://www.spammilter.com for details.

View raw message