I think this is nearly impossible or very tricky. I’m using CriteriaBuilder, JPA 2.0, Hibernate and MariaDB and want to build the following query with CriteriaBuilder:
SELECT COUNT(*) FROM
(SELECT DISTINCT(SomeColumn) // I think this is not possible?
FROM MyTable
WHERE ... COMPLEX CLAUSE ...
GROUP BY SomeColumn) MyTable
My Question: Possible? And if, how?
Thanks for wrapping your mind around this!
Mark
This example assumes that you’re using Metamodel generation.