db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mahler Thomas <thomas.mah...@itellium.com>
Subject AW: rowsets
Date Thu, 19 Dec 2002 08:50:21 GMT
Hi Michael,

> All,
> 
> How would you feel about supporting RowSets in Ojb?  By that, 
> I mean being able to do something like:
> 
>     RowSet rowset = getRowSetFromXmlFile();
> 
>     Iterator iterator = broker.getIteratorForRowset(Class 
> objectClass, rowset);

This could be easily achieved by building a RowReader that can handle
RowSets.
But I don't see why the PersistenceBroker should be responsible for handling
such RowSets?

> 
> The source of the rowset could be absolutely anything 
> imaginable, so don't get hung up on the Xml example.
> 
> It would also be cool to do something like:
> 
>     Iterator iterator = broker.getIteratorForQuery(Query 
> query, Class rowsetClass);
> Here, the broker would instantiate an instance of the request 
> RowSet implementation class and populate it with the results 
> of the query.  This would make it easy to add external 
> functionality such as logical cursors, or  -- to use the Jdbc 
> 2.0 terminology -- disconnected scrollable ResultSets that 
> materialize rows on-demand.

Did you have a look at the ManageableCollection stuff?
(http://jakarta.apache.org/ojb/apidocs/org/apache/ojb/broker/ManageableColle
ction.html)
IMO it would be easy to build this mechanism by defining an Iterator class
(Say RowsetIterator )that is backed by a ManageableCollection.
You can then use
PersistenceBroker.getCollectionByQuery(RowsetIterator.class, query) to get
your Iterator

http://jakarta.apache.org/ojb/apidocs/org/apache/ojb/broker/PersistenceBroke
r.html#getCollectionByQuery(java.lang.Class,%20org.apache.ojb.broker.query.Q
uery)

cheers,
Thomas



> Michael
> 


Mime
View raw message