ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Clinton Begin <clinton.be...@gmail.com>
Subject Re: Returning Three ArrayLists
Date Thu, 20 Aug 2009 15:00:35 GMT
Don't worry about the nextResultObject method.  It's just used to update the
result object and the count, it probably shouldn't be public, or maybe
resultcontext should be immutable... but for now, just ignore that method.
It's used internally by the ResultSetHandler.  I might make it an interface
and keep that method behind it in the implementation.

iBATIS iterates through the results for you, just pass your implementation
of ResultHandler into the select method.


Clinton

On Thu, Aug 20, 2009 at 7:54 AM, Richard Bibb <richard.bibb@aimhedge.com>wrote:

>
> Hi Clinton
>
> Your reply was exactly what I wanted. My only problem is that I'm not quite
> sure how to use the ResultContext object that is returned to me (iBatis3.0)
>
> ResultContext has a number of methods associated with it. One tells you how
> many rows were returned, another gives you a resultObject and the confusing
> one is the nextResultObject method. It looks to me as if I'm meant to
> itterate over the result set using nextResultObject. Is that right and if
> so
> what is the getResultObject method for?
>
>
>
> Clinton Begin wrote:
> >
> > It's against the design of SQL and JDBC, but not iBATIS.... :-)
> >
> > Just write a custom RowHandler (or ResultHandler in iBATIS 3).
> >
> > I'll use pseudocode since I don't know which version you're using....
> >
> > //assume you just map the results to a HashMap originally
> >
> > List list1;
> > List list2;
> > List list3;
> > handleResult(Object result) {
> >   Map map = (Map) result;
> >   list1.add(map.get("Number1");
> >   list2.add(map.get("Number2");
> >   list3.add(map.get("Number3");
> > }
> >
> > Clinton
> >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Returning-Three-ArrayLists-tp25057560p25062567.html
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
>
>

Mime
View raw message