criteriabuilder group by distinct code example
Example: jpa criteria query group by multiple columns
cq.groupBy(root.get(MyObject_.field1), root.get(MyObject_.field2))
cq.groupBy(root.get(MyObject_.field1), root.get(MyObject_.field2))