ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tegan Clark <tegan.cl...@yahoo.com>
Subject Extending iBATIS to support queryForIterator()
Date Mon, 08 Jan 2007 18:36:53 GMT
Hi,
 
I've extended iBATIS to support a new method queryForIterator() which works in a manner similar
to queryForList(), but returns an Iterator of the mapped objects rather than a List.  I've
done this so that iBATIS can support potentially very large result sets in a manner that doesn't
break the encapsulation around JDBC, i.e. it's objects in, objects out.
 
This solution differs from an approach that would use a RowHandler in that:
 
* I don't have to handle the row, iBATIS is still doing all of its magic for me.
* If I wish to perform some business logic etc on the returned result I can do this in a higher
layer than the DAL.
* External API's that want to consume an Iterator can do so.
* I can stream the results straight out to a csv, servlet etc without having to implement
something like a queue or file buffer.
 
I think this approach addresses 50% of the reasons everyone is asking for access to the ResultSet
without breaking encapsulation.
 
Is this something the iBATIS community would be interested in having contributed?  I am of
course happy to accept feedback and adapt my code to meet the needs of the broader iBATIS
community or tune my internal strategy with expert advice.
 
Input appreciated.
 
Tegan

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
Mime
View raw message