You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by bhaarat Sharma <bh...@gmail.com> on 2007/12/17 22:44:07 UTC

way to get resultSet as a list w/out putting data in class

Hello,

I am trying to convert resultSet code to use iBatis.

I know in iBatis the results are put in a class and returned as a
collection of those classes.  But my code has a lot of logic in which
we are iterating over the resultset and there are lots of conditional
(if/else)statements.

I am wondering if there is a way to get the results from iBatis as a
simple plain list.
So I can treat the returned list from iBatis as a resultSet basically.

Thanks!

Re: way to get resultSet as a list w/out putting data in class

Posted by Larry Meadors <lm...@apache.org>.
What do you want in the list..anti-matter?

Larry


On Dec 17, 2007 2:44 PM, bhaarat Sharma <bh...@gmail.com> wrote:
> Hello,
>
> I am trying to convert resultSet code to use iBatis.
>
> I know in iBatis the results are put in a class and returned as a
> collection of those classes.  But my code has a lot of logic in which
> we are iterating over the resultset and there are lots of conditional
> (if/else)statements.
>
> I am wondering if there is a way to get the results from iBatis as a
> simple plain list.
> So I can treat the returned list from iBatis as a resultSet basically.
>
> Thanks!
>

Re: way to get resultSet as a list w/out putting data in class

Posted by Jeff Butler <je...@gmail.com>.
Use a HashMap as the result class.  You'll get back a List of HashMaps with
the entire result set.

Jeff Butler



On Dec 17, 2007 3:44 PM, bhaarat Sharma <bh...@gmail.com> wrote:

> Hello,
>
> I am trying to convert resultSet code to use iBatis.
>
> I know in iBatis the results are put in a class and returned as a
> collection of those classes.  But my code has a lot of logic in which
> we are iterating over the resultset and there are lots of conditional
> (if/else)statements.
>
> I am wondering if there is a way to get the results from iBatis as a
> simple plain list.
> So I can treat the returned list from iBatis as a resultSet basically.
>
> Thanks!
>

Re: way to get resultSet as a list w/out putting data in class

Posted by bhaarat Sharma <bh...@gmail.com>.
Thanks,

I already looked at an example and dont think it will fit our
requirements. we plan on using HashMaps.



On Dec 18, 2007 7:42 PM, Brian Parkinson <pa...@avaning.com> wrote:
> Hi Bharaat.
>
> I am using a RowHandler to map the results to a Java object, and then
> post-process the list of objects to create the final result - a way to
> filter or combine results - I'm not sure exactly what you are doing, so
> unsure if this is a fit.
>
> The iBATIS SQL Maps for Java developer guide at
>
> http://ibatis.apache.org/javadownloads.cgi
>
> contains an example.
>
> I believe that returning a Map is fastest (less introspection) but if
> you want to get objects and the do some work on these, a row handler
> might fit the bill.
>
> Cheers,
>
> parki...
>
>
> -----Original Message-----
> From: bhaarat Sharma [mailto:bhaarat.s@gmail.com]
> Sent: Tuesday, December 18, 2007 3:53 PM
> To: user-java@ibatis.apache.org
>
> Subject: Re: way to get resultSet as a list w/out putting data in class
>
> hi,
>
> do you have an example of rowHandler implementation?
>
> will that be more effecient than HashMaps? and how will we retrieve
> results in the java code.
>
> w/ hashMap we can just do map.get(\"propertyName\");
> On 12/18/07, Brian Parkinson <pa...@avaning.com> wrote:
> Hi -
> >
> > One may might be to implement a row handler.
> >
> > parki...
> >
> >
> > -----Original Message-----
> > From:
> > Sent: Monday, December 17, 2007 3:44 PM
> > To: user-java@ibatis.apache.org
> > Subject: way to get resultSet as a list w/out putting data in class
> >
> > Hello,
> >
> > I am trying to convert resultSet code to use iBatis.
> >
> > I know in iBatis the results are put in a class and returned as a
> > collection of those classes.  But my code has a lot of logic in which
> > we are iterating over the resultset and there are lots of conditional
> > (if/else)statements.
> >
> > I am wondering if there is a way to get the results from iBatis as a
> > simple plain list.
> > So I can treat the returned list from iBatis as a resultSet basically.
> >
> > Thanks!
> >
>



-- 
-bhaarat

RE: way to get resultSet as a list w/out putting data in class

Posted by Brian Parkinson <pa...@avaning.com>.
Hi Bharaat.

I am using a RowHandler to map the results to a Java object, and then
post-process the list of objects to create the final result - a way to
filter or combine results - I'm not sure exactly what you are doing, so
unsure if this is a fit.

The iBATIS SQL Maps for Java developer guide at

http://ibatis.apache.org/javadownloads.cgi

contains an example.

I believe that returning a Map is fastest (less introspection) but if
you want to get objects and the do some work on these, a row handler
might fit the bill.

Cheers,

parki...


-----Original Message-----
From: bhaarat Sharma [mailto:bhaarat.s@gmail.com] 
Sent: Tuesday, December 18, 2007 3:53 PM
To: user-java@ibatis.apache.org
Subject: Re: way to get resultSet as a list w/out putting data in class

hi,

do you have an example of rowHandler implementation?

will that be more effecient than HashMaps? and how will we retrieve
results in the java code.

w/ hashMap we can just do map.get(\"propertyName\");
On 12/18/07, Brian Parkinson <pa...@avaning.com> wrote:
Hi -
>
> One may might be to implement a row handler.
>
> parki...
>
>
> -----Original Message-----
> From:
> Sent: Monday, December 17, 2007 3:44 PM
> To: user-java@ibatis.apache.org
> Subject: way to get resultSet as a list w/out putting data in class
>
> Hello,
>
> I am trying to convert resultSet code to use iBatis.
>
> I know in iBatis the results are put in a class and returned as a
> collection of those classes.  But my code has a lot of logic in which
> we are iterating over the resultset and there are lots of conditional
> (if/else)statements.
>
> I am wondering if there is a way to get the results from iBatis as a
> simple plain list.
> So I can treat the returned list from iBatis as a resultSet basically.
>
> Thanks!
>

Re: way to get resultSet as a list w/out putting data in class

Posted by bhaarat Sharma <bh...@gmail.com>.
hi,

do you have an example of rowHandler implementation?

will that be more effecient than HashMaps? and how will we retrieve
results in the java code.

w/ hashMap we can just do map.get(\"propertyName\");
On 12/18/07, Brian Parkinson <pa...@avaning.com> wrote:
Hi -
>
> One may might be to implement a row handler.
>
> parki...
>
>
> -----Original Message-----
> From:
> Sent: Monday, December 17, 2007 3:44 PM
> To: user-java@ibatis.apache.org
> Subject: way to get resultSet as a list w/out putting data in class
>
> Hello,
>
> I am trying to convert resultSet code to use iBatis.
>
> I know in iBatis the results are put in a class and returned as a
> collection of those classes.  But my code has a lot of logic in which
> we are iterating over the resultset and there are lots of conditional
> (if/else)statements.
>
> I am wondering if there is a way to get the results from iBatis as a
> simple plain list.
> So I can treat the returned list from iBatis as a resultSet basically.
>
> Thanks!
>

RE: way to get resultSet as a list w/out putting data in class

Posted by Brian Parkinson <pa...@avaning.com>.
Hi -

One may might be to implement a row handler.

parki...


-----Original Message-----
From: bhaarat Sharma [mailto:bhaarat.s@gmail.com] 
Sent: Monday, December 17, 2007 3:44 PM
To: user-java@ibatis.apache.org
Subject: way to get resultSet as a list w/out putting data in class

Hello,

I am trying to convert resultSet code to use iBatis.

I know in iBatis the results are put in a class and returned as a
collection of those classes.  But my code has a lot of logic in which
we are iterating over the resultset and there are lots of conditional
(if/else)statements.

I am wondering if there is a way to get the results from iBatis as a
simple plain list.
So I can treat the returned list from iBatis as a resultSet basically.

Thanks!