Marius Dumitru Florea wrote:
Hi Jeremie,
The sql query you suggested is cleaner and at least as efficient as the current one. It was my first option but unfortunately it's not supported by the newer versions of mysql. I've no idea why..
mysql> select xws_name, sum(xws_page_views) as pageviewcount from xwikistatsdoc where xws_action='view' and xws_name like '%.%' group by xws_name order by pageviewscount desc; ERROR 1054 (42S22): Unknown column 'pageviewscount' in 'order clause'
Note that there's a typo: pageviewcount <> pageview-S-count
Anyway, hibernate should be responsible for the correct translation from hql to a specific sql dialect. A solution would be to use the (idea from the) above sql but configure the dialect to MySQL5Dialect (in my case). I have to test this. I'll give you feedback soon.
Best Regards, Marius.
-- Sergiu Dumitriu http://purl.org/net/sergiu/