Search code examples
javapackagejdo

JDO - How do I define a package in a declareParameters call?


I'm attempting to do a JDO query with a filter based on one of my own classes:

Query q = pm.newQuery(Child.class);
q.setFilter("parent = parentParam");
q.declareParameters("Parent parentParam");
List<Child> childList = (List<Child>) q.execute(someParent);

However, I keep getting the following error:

Class Parent for query has not been resolved. Check the query and any imports/aliases specification

Based on the information I got from this answer, I need to define the Parent class package in the declareParameters call. How would this be done? Thank you much!


Solution

  • After some additional research and some trial and error, I figured it out:

    q.declareParameters("com.mypackage.Parent parentParam");