Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

setForwardOnly(true) does not iterate correctly through rowset

316040Sep 25 2002
I am encountering a problem using setForwardOnly(true) with my View Objects. When I change my VO's to setForwardOnly(true), calling next() on them does not iterate to the next row.

For instance, I try this code (just an example):

void someMethodInViewObjectImpl ()
{
setForwardOnly(true);
setFetchMode(FETCH_ALL);
executeQuery ();

Row tempRow;
tempRow = next ();
for (int i=0; i<getRowCount(); i++)
{
for (int j=0; j<tempRow.getAttributeCount(); j++)
{
if (tempRow.getAttribute(j) != null)
System.out.print(tempRow.getAttribute(j).toString() + " ");
}
System.out.print ("\r\n");
tempRow = next();
}
}

The first call to next() returns the last row of the rowset, as does each subsequent call to next()

If I change the fetch mode to FETCH_AS_NEEDED, then the first call to next() returns the first row of the rowset, and each subsequent call returns the last row.

If I change setForwardOnly(false), the iteration works correctly.

Is there something I am missing about using setForwardOnly(true), or is there a bug with using it?

I am using 9.0.2.
Thank you for any assistance.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 25 2002
Added on Sep 25 2002
5 comments
376 views