How do I return result 0-25, 26-50, 51-75 etc....
How do I return result 0-25, 26-50, 51-75 etc....
Check out the Hibernate JavaDocs for the Query interface - it talks about paging using setMaxResults and setFirstResult.
Rob
Watch out for crappy database queries. Hibernate translates pagination for Ms Sql to a select top query. So if you need 9.900 to 10.000 you will get 10.000 records and not 100. This could be a serious performance problem.
blog: http://pveentjer.wordpress.com project: STM Implementation http://multiverse.googlecode.com
But what on the HibernateTemplate am I suppose to use?
I am using Hibernate solely through the Spring Hibernate templates.
Originally Posted by robh
You have to create a session somewhere so you can create a Criteria/Query/SqlQuery that can be executed to retrieve the information.Originally Posted by mickknutson
For more information see:
http://www.hibernate.org/hib_docs/ap.../Criteria.html
And check the
setMaxResults(int maxResults)
setFirstResult(int firstResult)
to use pagination.
blog: http://pveentjer.wordpress.com project: STM Implementation http://multiverse.googlecode.com
Read the following section of the Spring reference guide:
11.2.3. Inversion of Control: HibernateTemplate and HibernateCallback
http://static.springframework.org/sp...m.html#d0e6874