priyank15 wrote:
Hi,
I have the following native sql query for MySQL
Code:
top10UserActivityQuery =
"select sum(trans_cnt) as t_cnt, employeeid as username from map2_data "+
"where fdate between (:datefrom) and (:dateto) and res_id=:res_id and location =:location "+
"group by employeeid order by t_cnt desc limit 10;"
considering I have map2_data as my domain class how would the query change in HQL?
It will be nearly the same in HQL. Something like:
Code:
top10UserActivityQuery =
"select sum(transCnt) as tCnt, employeeId as username from map2Data "+
"where fdate between (:datefrom) and (:dateto) and resId=:resId and location =:location "+
"group by employeeId order by tCnt desc;"
The limit would have to be implemented by using setMaxResults() on the query object.