Ibatis 调用存储过程 返回值替空 求真相
Ibatis 调用存储过程 返回值为空 求真相
1:
首先看存储过程语句(我是用Navicat 8)
CREATE PROCEDURE `test14`(out i_c int) begin declare i_c int; set i_c=1+3; end;
2:再看配置文件中的设置
<parameterMap id="loginUserParameters" class="java.util.HashMap"> <parameter property="i_c" jdbcType="int" javaType="java.lang.Integer" mode="OUT"/> </parameterMap>
<procedure id="getAllUserByProu4" parameterMap="loginUserParameters" > {call test14(?)} </procedure>
3:在看我文件中的调用(贴主要代码)
HashMap<String,Integer> map=new HashMap<String,Integer>(); map.put("i_c", null); sqlMap.startTransaction(); sqlMap.insert("getAllUserByProu4",map); System.out.println("进入系统"); System.out.println(map.get(i_c)); sqlMap.commitTransaction();
我试过将HashMap<String,Integer>换成HashMap<Integer,Integer>.效果都一样哦。就是取不到值。我已经疯狂的找了一天的代码了。。哎没辙了哈。坐等真相