Usually I\'m a Hibernate user and for my new project we use JPA 2.0.
My DAO receives a Container with a generic.
public class Container {
As long as your T
is Comparable
(it's required for greaterThan
), you should be able to do something like the following:
public class Container> {
...
public Predicate toPredicate(CriteriaBuilder cb, Root root) {
...
if (">".equals(operation) {
return cb.greaterThan(root.get(fieldId), value);
}
...
}
...
}