title: Retrieve Key-Value Pairs as Map
body: <p>I'm trying to retrieve two columns from the DB with iBatis.  I want to do it as a Map, such that <code>resultMap.get(col1) == col2Obj</code>.</p>
  
  <p>The same question was asked <a href="https://stackoverflow.com/q/3353526/684934">here</a>, but the posted solution won't work for me, and fails with the error: <code>Cannot cast List as Map</code>.  I am using iBatis 2.3.4.  (Is this feature available in this version?  I can't seem to find the relevant documentation.)</p>
  
  <p>My statement map:</p>
  
  <pre><code>&lt;resultMap id="countMap" class="java.util.HashMap"&gt;
      &lt;result property="key" column="KEY" /&gt;
      &lt;result property="value" column="VALUE" /&gt;
  &lt;/resultMap&gt;
  &lt;select id="getCounts" resultMap="countMap" parameterClass="map"&gt;
  SELECT
      TYPE AS KEY,
      SUM(VAL) AS VALUE
  FROM MYTABLE
  WHERE REGDATE BETWEEN #start_date# and #end_date#
  GROUP BY TYPE
  &lt;/select&gt;
  </code></pre>
  
  <p>The actual query returns:</p>
  
  <pre><code>|| KEY || VALUE ||
  || 4   || 304   ||
  </code></pre>
  
  <p>Calling <code>.toString()</code> on the Map that returns:</p>
  
  <pre><code>{"key" : "4", "value" : "304" }
  </code></pre>
  
  <p>Since the keyset consists of {"key", "value"}, the resultMap doesn't appear to be doing what I want it to do.  When I call the query with parameters that would result in more than 1 row, I get the error.</p>
  
  <p>I am using <code>sqlMapClient.queryForMap("mymap.getCounts", args);</code> to execute the query.</p>