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 ua...@yahoo.com on 2005/05/14 02:45:35 UTC

query to get records columns as List

Hello,
I am new to ibatis and want to know how I can do this.
I have a table "employee" and it has 5 columns. I want
to query the "employee" table and I want the result
either as a List of String[] (where the String[] has
column1,column2,column3,column4,column5 values) or as
a List of List (where the inner list will have the 5
columns).
thanks

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

Re: query to get records columns as List

Posted by Clinton Begin <cl...@gmail.com>.
You can't map columns to list elements...and that's probably a good thing. 
It doesn't really make sense semantically.

What you can do (which is significantly more useful) is map your results to 
a Map. That is, your employee table and its 5 columns will be represented as 
a Map (column1="whatever", column2="something"...etc.). You can also 
retrieve a list of these Maps, each list element will be one map that 
represents one row (i.e. one employee).

If you REALLY want a list of the columns, you can use map.values() to get 
the set of values and add the entire set to a list. 

Cheers,
Clinton


On 5/13/05, uap001@yahoo.com <ua...@yahoo.com> wrote:
> 
> Hello,
> I am new to ibatis and want to know how I can do this.
> I have a table "employee" and it has 5 columns. I want
> to query the "employee" table and I want the result
> either as a List of String[] (where the String[] has
> column1,column2,column3,column4,column5 values) or as
> a List of List (where the inner list will have the 5
> columns).
> thanks
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>