ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "srividhya umashanker" <srividh...@gmail.com>
Subject SQLMap - Fetching ArrayList within an HashMap result
Date Sat, 19 Mar 2005 03:46:17 GMT

I have the following XML entry

<resultMap id="result-tree1" class="java.util.HashMap">
     <result property="id" column="tree_id"/>
     <result property="screenName" column="screen_name" />
     <result property="Name" column="name" />
  <result property="column_id" column="tree_id"  select="getColumnDetails" />

   <!-- Fetches the values based on the mapping -->
  <select id="getTree2" resultMap="result-tree1" parameterClass="java.util.Map" >
    SELECT *
      FROM tree
      WHERE tree.tree_id = #id#<!-- when parameterMap is used ? has to be used -->

   <select id="getColumnDetails" resultClass="java.util.ArrayList" parameterClass="int">
    SELECT column_id
      FROM column_details 
      WHERE tree_id = #value# 

Where the resultMap has one entry which is an arrayList.

The java method call is 
Map param = new HashMap();
param.put("id",new Integer(90));

Map tree = (HashMap) sqlMap.queryForObject("getTree2",param);

But it throws executeQueryForObject() returns too many rows Exception..

How to go about it??

View raw message