public class RsIterator extends java.lang.Object implements OJBIterator
NOTE: OJB is very strict in handling RsIterator instances. RsIterator is
bound very closely to the used PersistenceBroker
instance.
Thus if you do a
- PersistenceBroker.close()
- PersistenceBroker.commitTransaction()
- PersistenceBroker.abortTransaction()
call, the current RsIterator instance resources will be cleaned up automatic
and invalidate current instance.
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.
Modifier and Type | Class and Description |
---|---|
static class |
RsIterator.ResourceClosedException |
static class |
RsIterator.ResourceNotClosedException |
static class |
RsIterator.ResourceWrapper
Wraps a
RsIterator instance as WeakReference . |
Constructor and Description |
---|
RsIterator(RsQueryObject queryObject,
PersistenceBrokerImpl broker)
RsIterator constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
absolute(int row)
Moves the cursor to the given row number in the iterator.
|
void |
disableLifeCycleEvents()
Do not fire any PBLifeCycleEvent when reading next item.
|
int |
fullSize() |
ClassDescriptor |
getClassDescriptor() |
boolean |
hasNext()
returns true if there are still more rows in the underlying ResultSet.
|
java.lang.Object |
next()
moves to the next row of the underlying ResultSet and returns the
corresponding Object materialized from this row.
|
boolean |
relative(int row)
Moves the cursor a relative number of rows, either positive or negative.
|
void |
releaseDbResources()
Release all internally used Database resources of the iterator.
|
void |
remove()
removing is not supported
|
void |
setAutoRelease(boolean autoRelease)
Allows user to switch off/on automatic resource cleanup.
|
int |
size() |
java.lang.String |
toString() |
public RsIterator(RsQueryObject queryObject, PersistenceBrokerImpl broker)
queryObject
- query objectbroker
- the broker we should use.public boolean hasNext()
hasNext
in interface java.util.Iterator
public java.lang.Object next() throws java.util.NoSuchElementException
next
in interface java.util.Iterator
java.util.NoSuchElementException
public void remove()
remove
in interface java.util.Iterator
public int size() throws PersistenceBrokerException
size
in interface OJBIterator
PersistenceBrokerException
public int fullSize() throws PersistenceBrokerException
fullSize
in interface OJBIterator
PersistenceBrokerException
public boolean absolute(int row) throws PersistenceBrokerException
absolute
in interface OJBIterator
row
- the row to move to in this iterator, by absolute numberPersistenceBrokerException
public boolean relative(int row) throws PersistenceBrokerException
relative
in interface OJBIterator
row
- the row to move to in this iterator, by relative numberPersistenceBrokerException
public void releaseDbResources()
releaseDbResources
in interface OJBIterator
public void setAutoRelease(boolean autoRelease)
releaseDbResources()
.
public java.lang.String toString()
toString
in class java.lang.Object
public ClassDescriptor getClassDescriptor()
public void disableLifeCycleEvents()
OJBIterator
disableLifeCycleEvents
in interface OJBIterator
OJBIterator.disableLifeCycleEvents()
(C) 2002 - 2005 Apache Software Foundation
All rights reserved. Published under the Apache License 2.0.
http://db.apache.org/ojb
Version: 1.0.4, 2005-12-30