开发者

hql equivalent query to this sql query

Select top 1 fr开发者_如何学编程om <tablename>

what is hql query for the above ?


Just write a normal query, ans use "SetMaxResult" to limit your results.

I.e.

return  getSession().createQuery("from items order by id asc")
            .setMaxResults(1)
            .list();


It seems you must use the setMaxResults() method.

See for example this question+answer : How do you do a limit query in HQL


You'll probably want to use the setMaxResults of the Query Object.

To my knowledge, HQL does not support top or limit.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜