Query query = pm.newQuery();
query.setClass(Company.class);
query.setCandidates(pm.getExtent(Company.class, false));
query.declareImports("import org.apache.jdo.tck.pc.company.Employee; import org.apache.jdo.tck.pc.company.Department");
query.declareVariables("Department d; Employee e" );
query.setFilter("departments.contains(d) && (d.employees.contains(e) && e.firstname==\"Michael\")");
Object results = query.execute();
// Just check whether query with import declarations compiles