Tuesday, March 2, 2010

RowSetIterator example

Because of its utility I would like to give an example of a piece of RowSetIterator code which will help avoid row currency issues, even if your void object instance is used by a UI component:

I use it as a method in VOImpl class to help me navigate to a particular row without changing the row currency of the RowSetIterator of the VO instance that is also connected to a UI and could thereby cause row currency issues. (BTW this was a best practice I took out of the ADF Developers 10g Guide; my guess is that it is still best practice...but it might not be.):

  private AnotherViewRowImpl findRowMatch (Number pMenuId) {
        if (!this.isExecuted()) {
        boolean lFoundMatch = false;
        TbReviewerCommentAnotherViewRowImpl lRow = null;
        RowSetIterator lRSI = this.createRowSetIterator(null);
        while(lRSI.hasNext()) {
            lRow = (TbReviewerCommentAnotherViewRowImpl)lRSI.next();
            if (pMenuId != null && pMenuId.equals(lRow.getMenuItemId())) {
                lFoundMatch = true;
        if (!lFoundMatch) {
            lRow = null;
        return lRow;

No comments: