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.
精彩评论