ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rajanikanth Gaddam" <gra...@gmail.com>
Subject Re: implementing HashMap of HashMaps in resultMap...
Date Fri, 03 Mar 2006 16:22:28 GMT
How do I implement map of maps using Ibatis? I have included the sql config
file.
>
> I am expecting a following result:
> HashMap -->    key   --> manager
>                        value --> java.util.Map -->    key     -->
> orderId
>                                                                 value
> -->    List of beans of type test.Trade
>
> I appreciate all the help.
>
> <sqlMap namespace="report">
>  <resultMap id="getDataMap" class="test.ResultHolder" groupBy="manager">
>   <result property="manager" column="mgr" />
>   <result property="orderIdMap" resultMap="orderIdMap" />
>  </resultMap>
>
>  <resultMap id="orderIdMap" class="java.util.HashMap" groupBy="orderId">
>   <result property="orderId" column="order_id" />
>   <result property="beanList" resultMap="beanList" javaType="
> java.util.ArrayList"/>
>  </resultMap>
>
>  <resultMap id="beanList" class="test.Trade">
>   <result property="txnId" column="txn_id" />
>   <result property="tradeDisplayType" column="trd_display_id" />
>   <result property="tradeType" column="trd_type" />
>   <result property="numberOfShares" column="shr_face" javaType="double" />
>   <result property="sharePrice" column="u_price" javaType="double" />
>   <result property="tradeDate" column="txn_date" javaType="java.util.Date"
> />
>   <result property="settleDate" column="set_date" javaType="java.util.Date"
> />
>  </resultMap>
>
>  <select id="getData" resultMap="getDataMap">
>  select
>   mgr,
>   order_id,
>   oms_order_id ,
>   gloss_txn_id ,
>   trd_display_id,
>   trd_type,
>   shr_face,
>   u_price,
>   txn_date
>      from
>   Tab_A
>  </select>
> </sqlMap>
>
> Thanks and Regards
> Raj
>

Mime
View raw message