In JPA2 there is a query API referred to as "criteria". This is really an API allowing
the construction of queries expression by expression, and optionally making it type safe
so that if you refactor a field name then it is changed in the queries.
JDO has no such feature currently, but there exist third party extensions providing this.
One is called
Its documentation can be found here.