Hi all,
I am using struts,spring and Hibernate2 ,MSSQL 2000 in my application.
I have used Criteria class to get the paginated results for my search screen.
My code looks like this,
Criteria criteria = session.createCriteria(Search.class);
criteria.setFirstResult(pageNo*pageSize)
criteria.setMaxResults(pageSize);
I have set the pagesize(Number of records to be displayed in the screen) to 10. Am getting the right output when i click the first page.The query returns top 10 records from the table.When i click the next page i.e page 2 the hibernate query generated is "select top 20..." The query should be with a limit statement like limit 10,20, right? What should i do to generate a query with limit statements.
Please help me out.
Thanks in Advance.
|