I partly figured this one out, and that's good enough for me. The
modified version of the XML follows. The code I was modifying made use
of SqlMapClient.queryForObject(). What I needed was
SqlMapClient.queryForList().
<parameterMap id="params" class="map">
<parameter property="po_rc" javaType="java.sql.ResultSet"
jdbcType="ORACLECURSOR" mode="OUT"/>
<parameter property="po_rec_cnt" javaType="java.lang.Long"
jdbcType="BIGINT" mode="OUT"/>
<parameter property="po_currency_flag"
javaType="java.lang.Long" jdbcType="BIGINT" mode="OUT"/>
<parameter property="pi_company_id" jdbcType="NUMBER"
javaType="java.lang.Long" mode="IN"/>
</parameterMap>
<procedure id="getData" parameterMap="params"
resultClass="java.util.LinkedHashMap">
{call pkg.foo(?,?,?,?)}
</procedure>
Ian.
________________________________
From: Stevens, Ian [mailto:[email protected]]
Sent: July 20, 2009 1:11 PM
To: [email protected]
Subject: RE: Implicit map/list for result set of stored
procedure call?
Am I to understand that iBatis needs a column name mapping,
otherwise no columns are stored in the map? There's no way to
short-circuit this behaviour and just place the columns in a hash map
keyed on the original column names? I need a more dynamic map as the
stored procedure I am using returns a different cursor depending on the
results. Any suggestions?
thanks,
Ian.
________________________________
From: Stevens, Ian [mailto:[email protected]]
Sent: July 16, 2009 3:10 PM
To: [email protected]
Subject: Implicit map/list for result set of stored
procedure call?
I'm trying to grab data from an Oracle stored procedure
using iBatis 2.3.4. I have something like the following in my XML:
<resultMap id="result" class="hashmap">
<result property="year" column="YEAR"/>
</resultMap>
<parameterMap id="params" class="map">
<parameter property="po_rc"
javaType="java.sql.ResultSet" jdbcType="ORACLECURSOR" mode="OUT"
resultMap="result"/>
<parameter property="po_rec_cnt"
javaType="java.lang.Long" jdbcType="BIGINT" mode="OUT"/>
<parameter property="po_currency_flag"
javaType="java.lang.Long" jdbcType="BIGINT" mode="OUT"/>
<parameter property="pi_company_id"
jdbcType="NUMBER" javaType="java.lang.Long" mode="IN"/>
</parameterMap>
<procedure id="getData" parameterMap="params">
{call pkg.foo(?,?,?,?)}
</procedure>
There are a number of columns in the result set. Is it
possible to have the procedure implicitly populate a map with each row
of the results? or do I have to explicitly specify mappings for each
column like I did with YEAR above? I just need the values in the order
they appear as columns.
Better still, can I have the result populated as a list
of lists, one list per row containing the values of the columns in
order?
thanks,
Ian.