This iBatis feature is deprecated and discarded from iBatis library. moreover it has performance issue, hence i’m striking out this blog post 🙂 thanks for visiting this post.
iBatis has very good pagination support. every query can be limited by max number of rows and scrollable.
for example i have executed “queryForPaginatedList( “queryName”, domainObject, MAX_ROWS ) “;
iBatis PaginatedList class is extension of “java.util.List” class. so you can generally use it as collection object.
following methods are added to PaginatedList class:
page size is current size of list (list.size() == MAX_ROWS)
if page offset is 0 no “nextPage” is invoked (default state)
if between last and first offset (though did not use it, just assumption)
if page offset == total available page
if current offset is not the last offset
if current offset is not set to ‘0’ i mean already (nextPage(…)) invoked.
hit database(or cache) to load next MAX_ROWS number of items
hit database(or cache) to load rows from certain range from current state to one step backward.
void gotoPage(int i);
move forcefully to certain page by specified offset
return current page index(offset) number
How to paginate through your records?:
1. let’s think some one accessed your controller, you performed some retrieval task, and stored this “PaginatedList” object into session context.
2. when user request for “next” page. you just load your object from session and invoke “pgList.nextPage()”
3. when user request for “back/previous” page you just load your object from session and invoke “pgList.previousPage()”
4. and set again in session context.
5. access from view .. and render your desire UI…
regards and Eid Mubarak!!!