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

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -