ibatis2.x学习之oracle存储过程调用配置

mengsun 2010-06-16

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sqlMap      
    PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"      
    "http://ibatis.apache.org/dtd/sql-map-2.dtd">
<sqlMap namespace="testProcedure">
	<parameterMap class="java.util.Map" id="procedureMap">
		<!-- 设置存储过程输出参数 -->
		<parameter property="curr" jdbcType="ORACLECURSOR"  javaType="java.sql.ResultSet" mode="OUT" />
	</parameterMap>

	<!-- resultClass设置游标返回数据类型 -->
	<procedure id="getAllUser" resultClass="org.yhb.ibatisdemo.User" parameterMap="procedureMap">
		{call getAllUser(?)}
	</procedure>
</sqlMap>
//调用存储过程代码
		List userList = sqlMapClient.queryForList("getAllUser");
create or replace procedure getAllUser(curr_users out sys_refcursor)
as
begin 
  open curr_users for select * from user;
end;

相关推荐