Tuesday 15 May 2012

Pagination


Pagination:
     
    When Query is select huge amount of records instead of displaying them in a single screen or single page it is recommanded to display them in multiple screens or multiple pages through “pagenation” concept.

 Hibernate provides some methods in Query class.
a)setFirstResult(int)
b)setMaxResult(int)
setFirstResult(int): this method is used start the postion from the table. Postion starts from 0
If we use setFirstResult(2) & setMaxResult(3) it strart selecting from 2 record to 5 record
Hibernate internally uses the pseudo column called rownum while generating sql query for oracle database software based on the above code.
For Sample Project

No comments:

Post a Comment