java - hibernate 4 Mssql 2008 limit string -
i need run following hql query:
select top 1000 ent myentity ent ....
but complains on token 1000. how can set limit manually mssql 2008 in hql?
limit operator not supported in hql queries. have 2 solutions :
using hql:
query q = session.createquery("from myentity ..."); q.setfirstresult(1); q.setmaxresults(1000);
using nativequery:
query q = session.createnativequery("select * myentity ... limit 0, 1000");
Comments
Post a Comment