I checked the SpringSource blog http://blog.springsource.com/2011/04...-and-querydsl/.
Now, how to create a Specification with Sort on multiple attributes of the same class.
e.g. Customer isLongTermCustomer specification order by JoiningDate DESC, isPremium ASC.Code:public static Specification<Customer> isLongTermCustomer() { return new Specification<Customer> { public Predicate toPredicate(Root<T> root, CriteriaQuery query, CriteriaBuilder cb) { return cb.lessThan(root.get(Customer_.createdAt), new LocalDate.minusYears(2)); } }; }


Reply With Quote
