How do I count the number of rows returned by subquery?
I stumbled upon this issue as well. I would ultimately like to execute the following JPQL: SELECT COUNT(u) FROM ( SELECT DISTINCT u FROM User u JOIN u.roles r WHERE r.id IN (1) ) But this wasn’t possible, also not with criteria API. Research taught that this was just a design limitation in JPA. The … Read more