RsIterator can be used to iterate over a jdbc ResultSet to retrieve
persistent objects step-by-step and not all at once. In fact the
PersistenceBroker::getCollectionByQuery(...) method uses a RsIterator
internally to build up a Collection of objects
NOTE: this code uses features that only JDBC 2.0 compliant Drivers support.
It will NOT work with JDBC 1.0 Drivers (e.g. SUN's JdbcOdbcDriver) If you
are forced to use such a driver, you can use code from the 0.1.30 release.
getProxyFromResultSet() Reads primary key information from current RS row and generates a
corresponding Identity, and returns a proxy from the Identity.
next() moves to the next row of the underlying ResultSet and returns the
corresponding Object materialized from this row.
public boolean
relative(int row) Moves the cursor a relative number of rows, either positive or negative.
Attempting to move beyond the first/last row in the iterator positions
the cursor before/after the the first/last row.
Moves the cursor to the given row number in the iterator. If the row
number is positive, the cursor moves to the given row number with
respect to the beginning of the iterator. The first row is row 1, the
second is row 2, and so on.
Parameters: row - the row to move to in this iterator, by absolute number
returns a fully materialized Object from the current row of the
underlying resultset. Works as follows: - read Identity from the primary
key values of current row - check if Object is in cache - return cached
object or read it from current row and put it in cache
Reads primary key information from current RS row and generates a
corresponding Identity, and returns a proxy from the Identity.
throws: PersistenceBrokerException - if there was an error creating the proxy class
Moves the cursor a relative number of rows, either positive or negative.
Attempting to move beyond the first/last row in the iterator positions
the cursor before/after the the first/last row. Calling relative(0) is
valid, but does not change the cursor position.
Parameters: row - the row to move to in this iterator, by relative number
Release all internally used Database resources of the iterator. Clients
must call this methods explicitely if the iterator is not exhausted by
the client application. If the Iterator is exhauseted this method will
be called implicitely.
public void setAutoRelease(boolean autoRelease)(Code)
Allows user to switch off/on automatic resource cleanup.
Set false to take responsibility of resource cleanup
for this class, means after use it's mandatory to call
RsIterator.releaseDbResources .
By default it's true and resource cleanup is done
automatic.