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 Guido García Bernardo <gg...@tid.es> on 2006/03/08 23:16:36 UTC

Re: how to traverse a table using resultClass="java.util.HashMap" ?

Thank you, I  was not seeing it because I was blind with the queryForMap 
method.

guido.

Jeff Butler escribió:
> If you execute this statement with the queryForList method, iBATIS 
> will return a List of HashMaps - one HashMap for every row in the table.
>  
> Jeff Butler
>
>  
> On 3/8/06, *Guido García Bernardo* <ggb275@tid.es 
> <ma...@tid.es>> wrote:
>
>     Hello !
>
>     I can read in the ibatis SQL maps developer guide:
>
>     ----
>     <statement id="getProductCount" resultClass=" java.util.HashMap">
>     select * from PRODUCT
>     </statement>
>
>     The above would basically give you a Map representation of the
>     returned
>     ResultSet.
>     ----
>
>     Could anyone elaborate on how exactly this Map represents the
>     returned
>     ResultSet?
>     In example, how could I traverse the following PRODUCT table using
>     a Map?
>
>     id   name             stock    price
>     --   -------------     -----     ------
>     1    DVD player    80        30
>     2    CD player      10         20
>
>     Java code that dumps this table with no need to define a resultMap
>     would
>     be appreciated :)
>     Thank you,
>
>     --
>     Guido García Bernardo
>