iBatis PaginatedList and pagination

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:

int getPageSize();

page size is current size of list (list.size() == MAX_ROWS)

boolean isFirstPage();

if page offset is 0 no “nextPage” is invoked (default state)

boolean isMiddlePage();

if between last and first offset (though did not use it, just assumption)

boolean isLastPage();

if page offset == total available page

boolean isNextPageAvailable();

if current offset is not the last offset

boolean isPreviousPageAvailable();

if current offset is not set to ’0′ i mean already (nextPage(…)) invoked.

boolean nextPage();

hit database(or cache) to load next MAX_ROWS number of items

boolean previousPage();

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

int getPageIndex();

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!!!

A request !!

please stop piracy, stop piracy your favorite music album. stop sharing your favorite album with your the best friend.
rather gift her/him a new favorite album. encourage our talents our artists.
an album does not cost much… but it worth much for an artist… please encourage them…
let them produce more creative artistic album. prove your true love for your loving artist…

my simple request to all folks … STOP PIRACY STOP MUSIC PIRACY FIRST … LET INSPIRE …

my tweets

 

October 2006
S S M T W T F
« Sep   Nov »
 123456
78910111213
14151617181920
21222324252627
28293031  

Flickr Photos

@kamalapur over bridge

@kamalapur station

cox's bazaar trip oct 09

cox's bazaar trip oct 09

cast ur vote!

More Photos
Follow

Get every new post delivered to your Inbox.