获取存储过程返回结果
代码:
//
Map<String,Object> map = new HashMap<String,Object>(); map.put("id","11"); loginDao.login(map); //获取结果集 map.get("result_2"); map.get("resultbean"); //dao层 public void login(Map<String,Object> map);
<resultMap id="loginMap" type="java.util.HashMap"> <result column = "SYS_ID" property = "sysId"/> <result column = "ROLE_ID" property = "roleId"/> <result column = "AUTH_ID" property = "authId"/> </resultMap> <select id="login" resultType="java.util.Map" statementType="CALLABLE"> <![CDATA[ call proc_login( #{id,mode=IN,jdbcType=VARCHAR}, #{result_2,mode=OUT,jdbcType=VARCHAR}, #{resultbean,mode=OUT,jdbcType=CURSOR,javaType=java.sql.ResultSet,resultMap=loginMap}) ]]> </select>
create or replace procedure proc_login( id in varchar2, result_2 out varchar2, resultbean out PKG_LOGIN.TYPE_RECORD ) as begin result_2 := '200'; open resultbean for select SYS_ID, ROLE_ID, AUTH_ID from t; end proc_login; CREATE OR REPLACE PACKAGE PKG_LOGIN AS TYPE TYPE_CURSOR IS REF CURSOR; TYPE TYPE_RECORD IS RECORD ( SYS_ID VARCHAR2(10), ROLE_ID VARCHAR2(10), AUTH_ID VARCHAR2(50) ); END;