Reputation: 47
I have a rowSetIterator with a total of 12 rows and a rangeSize of 5. I am accessing the rows like the following:
RowSetIterator rs = vo.getRowSetIterator();
int totalPages = rs.getEstimatedRangePageCount();
for(int pageIndex=0; pageIndex<totalPages; pageIndex++){
rs.scrollToRangePage(pageIndex + 1);
Row[] rows = rs.getAllRowsInRange();
for(int rowIndex=0; rowIndex<rows.length; rowIndex++){
Row row = rows[rowIndex];
print(row);
}
System.out.println("going to next page");
}
But this code results in printing the rows as shown below:
1 2 3 4 5
going to next page
6 7 8 9 10
going to next page
8 9 10 11 12
going to next page
Is there a way to retrieve only the remainder of the rows present when scrolled to the last page i.e. access only the 11th and 12th row(from the above example).
The viewObject is an updatable one and of access mode SCROLLABLE.
The above case mentioned is just an example. In actual case, I am dealing with larger rangeSize and larger data. Hence, needed some help to tune my viewObject to be more efficient.
Upvotes: 0
Views: 975
Reputation: 105
A viewObject is a RowIterator, so you do not need to iterate through with your own looping like that. By allowing the ADF framework to handle the range navigation, you should not encounter the same row twice. The following should get you close:
vo.reset();//puts us at slot before first row
while(vo.hasNext())
{
Row row = vo.next();//Automatically navigates rangesets when needed
print(row);
}
If you are concerned with performance, please read: https://docs.oracle.com/middleware/1213/adf/develop/adf-bc-view-object-tuning.htm
If you are iterating through all your rows, you may want to tune your view to have a larger range and fetch sizes (no more than 100 is typically recommended).
Finally, and more relevantly to your original question, you may want to ensure that "Fill Last Page of Rows when Paging through RowSet" option in the View tuning is NOT checked.
Upvotes: 1