-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: MySQLDialect supportsTupleDistinctCounts and HQL
PostPosted: Mon Dec 08, 2014 4:52 am 
Newbie

Joined: Mon Dec 08, 2014 4:37 am
Posts: 1
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 columns - 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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.