Converting normal sql query into hibernate criteria query -


i need convert sql query hibernate criteria,please guys.

select name, count(*) app
device group name order app desc limit 3

try code:

select device.name, count(device) device device group device.name order count(device) desc 

this assumes have entity class called device field name along getter method getname(). may have change query depending on actual code (which never showed us).

the limit clause had not applicable hql. instead, should doing query.setmaxresults().


Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -