Check out example codes for "jpa criteria query group by multiple columns". It will help you in understanding the concepts better.

Code Example 1

cq.groupBy(root.get(MyObject_.field1), root.get(MyObject_.field2))

Learn ReactJs, React Native from akashmittal.com