my code is:
Code:
public List<Object[]> getHistogram(Long limit)
{
return (List<Object[]>) session.createQuery
("select type, count(name)" +
" from " + (select" + (limit == null ? "" : " limit 0 " + limit) + " *" +
" from " + PLAYER_TABLE_NAME +
" order by acres desc" + ")" +
" group by type" +
" order by count(name) desc").list();
}
What i am doing is: returning number of players per each type.
But i want to query only for example 'limit' of top players, not all of them....
(so i ordered them)
I run this query directly in hsqldb gui and it works.
Doesnt work in the java code with hibernate for me.
The sql is fine