Monday 5 November 2012

Pagination with BC4J

There are two ways to to do pagination in BC4J.

There is one in build pagination is available in BC4J.

Create you VO object.
then
vo.setAccessmode(RowSet.PAGING_MODE);
vo.setWhereClauseParam(0,25);//for ROWNUM <= section
vo.setWhereClauseParam(1,0);//for ROWNUM> SECTION


Other-way to do this is.

Have one method like below

setPagingQuery(ViewObjectImpl vo){
vo.setQuery("SELECT * FROM (SELECT /*+ FIRST_ROWS */ IQ.*, ROWNUM AS Z_R_N FROM(" + 
                             vo.getQuery() + ")IQ  WHERE ROWNUM < " + end
                             ") WHERE Z_R_N >" + start);
}

then before your do execute your query. just call
setPagingQuery(this);
excecuteQuery();

No comments:

Post a Comment