Thursday, April 1, 2010

Bit #4 - Iterating a View Object using a secondary RowSetIterator

The recommended way to iterate a View Object is via a secondary RowSetIterator returned after calling createRowSetIterator() on the View Object. It is suggested to call reset() on the RowSetIterator before iterating it. This will move the currency to the slot before the first row. Iterate while calling hasNext() to check for next row availability and subsequently by calling next() to get the next row. When done, call closeRowSetIterator() to close the row set iterator. Failure to use a secondary RowSetIterator when directly iterating the View Object, could lead to end user confusion as the row set currency changes affecting the user interface.


// in the context of the AppModuleImpl

       RowSetIterator iterator = viewObject.createRowSetIterator(null);


while (iterator.hasNext()) {
   Row row =;

// process the row here



Application Module Implementation class
View Object Implementation class


Oracle® Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework 11g Release 1 (11.1.1) Part Number B31974-05 [Section 9.7.6 What You May Need to Know About Programmatic Row Set Iteration]


  1. Indeed the preffered way. :)
    Another way is the one below
    but it will lost the current row, so you will have problem if you use the VO to display data. Otherwise you do not really care.

    // in the context of the AppModuleImpl

    RowSetIterator iterator = viewObject.getRowSetIterator(null);

    while (iterator.getCurrentRow() != null) {
    Row row = iterator.getCurrentRow();

    // process the row here;



  2. Spyro, definitely not recommended :(. Please refer to section 9.7.6. of the B31974-05 documentation - link is referenced on the post.

  3. Hi Nick,
    Thanks for this post.

    If I'm not mistaken, this provides method to iterate over current RowSet.
    How about iterating over all rows?


  4. Hi Ilya,

    I am not sure what you are referring to... The above technique will let you iterate over all the rows.


Related Posts Plugin for WordPress, Blogger...