Wednesday, September 15, 2010

javax.jdo.JDOException: Class Date for query has not been resolved.

You have to declare missing imports using query.declareImports(). Example:

Query query = pm.newQuery(
    "SELECT FROM " + Device.class.getCanonicalName() + " WHERE" +
    " lastSeen < dataExpireDate"
query.declareImports("import java.util.Date");
query.declareParameters("Date dataExpireDate");

'or' filters can only check equality Exception

As described in "Query Filters" section here:

... keep in mind that || can only be employed when the filters it separates all have the same field name. In other words, || is only legal in situations where the filters it separates can be combined into a single contains() filter.