If there are multiple resultsets, you need to use ps.getMoreResults().

Larry


On 4/11/07, Jeff Butler <[EMAIL PROTECTED]> wrote:
This is very basic JDBC - I suggest you do a google search for "JDBC
Examples" or "JDBC Tutorial".

This, in effect, is what iBATIS is doing:

List answer = new ArrayList();
while (rs.next()) {
  SomeObject so = new SomeObject();
  so.setName(rs.getString("name"));
  so.setId(rs.getInt("id"));
  answer.add(so);
}

rs.close();

return answer;

There's only one result set in this example - but the result set contains
multiple records.

Jeff Butler



On 4/11/07, macdoug1 <[EMAIL PROTECTED]> wrote:
>
> To make a long story short the place that I have been doing work for
didn't
> like the iBatis mapping for some unknown reason but regardless of that I'm
> trying to figure out now how to handle one situation when performing my
> query. When using iBatis I did a queryForList("somestatement", objval);
and
> queryForList worked perfectly for me as it returned a list of known object
> types. Anyway I'm now using a PreparedStatement and using executeQuery,
> which returns a ResultSet which I can get multiple result sets. My
question
> is I can't seem to figure out a way to put the multiple result sets into a
> list which I can pass back to my business method that is expecting a list.
>
> rs = ps.executeQuery();
>
> while(rs.next()){
>
> ???
>
> }
>
> Anyway has anyone ever done something similar to this? Is there something
> better I can use that is closer to the queryForList ? I'm really desparate
> for a good solutioin here if anyone knows.
>
> --
> View this message in context:
http://www.nabble.com/Was-using-iBatis-but-have-been-forced-to-rip-it-out-of-my-code.-tf3559715.html#a9940771
> Sent from the iBATIS - Dev mailing list archive at Nabble.com.
>
>


Reply via email to