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 Hendry <he...@elasitas.com> on 2006/05/19 05:59:30 UTC
Need Help with sqlmap + refcursor oracle
Hi all,
I got an error message when calling procedure from my application, here
is my sql map queries.
...
<typeAlias alias="Order" type="valueobjects.Order"/>
<resultMap id="order-map-max" class="Content">
<result property="orderId" column="orderId" />
</resultMap>
<parameterMap id="single-rs" class="map">
<parameter property="output1" jdbcType="ORACLECURSOR" mode="OUT"/>
</parameterMap>
<procedure id="getMaxId" parameterMap="single-rs" resultMap="order-map-max">
{ call order_sel_max(?) }
</procedure>
...
the procedure in oracle :
-------------------------
CREATE OR REPLACE PROCEDURE "ORDER_SEL_MAX"
(
result_cursor IN OUT TYPES.cursor_type
)
IS
BEGIN
OPEN result_cursor FOR
SELECT MAX(id) as orderId
FROM
tbl_order;
END;
----------------------------------
public List getMaxOrderId(Map map) {
try {
return getSqlMapExecutor().queryForList("getMaxId", map);
} catch (SQLException e) {
throw new DaoException("Error selecting max id. Cause : " + e, e);
}
}
-------------------------------------
when i make a call to get max id, like this :
...
Map map = new HashMap();
List data = orderDao.getMaxOrderId(map);
...
I got an error like this,
Exception in thread "main" com.ibatis.dao.client.DaoException: Error
selecting max id. Cause :
com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in conf/queries.xml.
--- The error occurred while applying a result map.
--- Check the queries.order-map-max.
--- The error happened while setting a property on the result object.
--- Cause: java.lang.RuntimeException: Error setting properties of
'valueobjects.Order@1a9334'. Cause: java.lang.IllegalArgumentException
Caused by: java.lang.RuntimeException: Error setting properties of
'valueobjects.Order@1a9334'. Cause: java.lang.IllegalArgumentException
at dao.sqlmap.SqlMapOrderDao.getMaxOrderId(SqlMapOrderDao.java:95)
...
what's wrong with my result map?
--
Regards,
Hendry