Take the following example, simplified from the JDO specification.
class Employee {
  String name;
  Department dept;
}
class Department {
  String name;
}

I want to express the following JDO query: "Select all departments which have at least 
10 employees".
It seems natural to:
1- build a query Q1 which returns the employee for a given department (department is a 
parameter)
2- use Q1 as a kind of subquery for the main query.

Building Q1 should look like:

Class empClass = Class.forName("Employee");
Collection clnEmployee = pm.getExtent (empClass);
String filter = "dept = d";
String param = "Department d";
Query q = pm.newQuery (empClass, clnEmployee, filter);
q.declareParameters(param);

Building the main query should use class Department for the candidate JDO instances 
and result class.
During the evaluation of the main query, the current department instance should be the 
parameter value for Q1, and a filter should be such that the result size of executing 
Q1 is greater than 10.

How do I link Q1 with the main query? I.e., how do I pass as parameter the current 
department instance to Q1?

Thanks for any help,

Alexandre Lefebvre
[EMAIL PROTECTED]

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to