Hi,
This question has been asked various times over the last 10 years on this forum, and has rolled a donut every time in terms of help.
The problem is related to selecting a count of distinct column
s - IE: I have several projections, and I want to
select count(distinct ALL PROJECTIONS).
This appears to be quite a common issue.
I can see that the MySQLDialect does return true for
supportsTupleDistinctCounts, but the QueryTranslatorImpl doesn't like it at all:
Code:
org.hibernate.hql.internal.ast.QuerySyntaxException: expecting CLOSE, found ',' near line X ...
When will this be implemented? Can anyone tell me how to select a distinct count of all projections without having to run a query for each individual projection and then pick the highest count return? Is there any way to write and use my own QueryTranslator to do it (yes I am that desperate for this functionality)?
MySQL will happily run a query with a select distinct across multiple columns, but HQL won't translate it. How can I make it translate it?
PS: In this instance I can't use the Criteria API - I'm restricted to HQL. I'm using 4.2.2.Final in conjunction with Spring 4.0.1.RELEASE
Thanks for any help provided, by Hibernate developers or otherwise.