The JPA Criteria API supports dynamic definition of JPQL queries using CriteriaBuilder as a factory.
ObjectDB supports dynamic definition of JPQL queries as strings.
Support of the new JPA 2 Criteria API in expected in future versions.
ObjectDB Support