How do I get a distinct list of objects with JpaRepository.findAll using a
Predicate?
I have something like:
Predicate p = ...;
List<MyObject> objectList = (List<MyObject>) myRepository.findAll(p); //
myRepository is autowired
This gets the list of all MyObjects, with duplicates. Is it possible to
get a DISTINCT list instead?
Do I really need to use an EntityManager and CriteriaBuilder? Or can it be
done with just the predicate and the repository object? I'm not talking
about iterating through the list manually and removing duplicates.
No comments:
Post a Comment