ibatis调用oracle存储过程返回结果集的问题
xml代码
<!DOCTYPE mapper PUBLIC "-//ibatis.apache.org//DTD iBatis Mapper 3.0 //EN" "http://ibatis.apache.org/dtd/ibatis-3-mapper.dtd">
<mapper namespace="org.yhb.ibatis.dao.UserDAO">
<!-- 表结构
create table IBATIS_USER
(
ID NUMBER not null,
NAME VARCHAR2(20) not null,
BRITHDAY DATE not null
)
-->
<!-- 存储过程
create or replace procedure getAllUser(userList out sys_refcursor)
as
begin
open userList for select * from ibatis_user;
end;
-->
<!-- resultMap -->
<resultMap type="org.yhb.ibatis.model.User" id="userMap">
<id column="id" property="id" />
<result column="name" property="name" />
<result column="birthday" property="birthday" />
</resultMap>
<!-- 调用存储过程 -->
<select id="getAllUser" statementType="CALLABLE" resultMap="userMap">
{call getAllUser(#{userList,mode=OUT,javaType=java.sql.ResultSet,jdbcType=CURSOR,resultMap=userMap})}
</select>
</mapper>
java调用代码
public void testProcedure() throws Exception {
Reader reader = null;