sql - 应用参数映射时 iBatis 错误 - 由 SQLException : Cursor is closed 引起

标签 sql oracle cursor ibatis

我正在调试通过 iBatis for java 调用存储过程返回的 null ResultsMap 问题。这是我收到的异常的截断副本。

DataAccessException: Exception calling procedure
Caused by: com.ibatis.common.jdbc.exception.NestedSQLException: 
--- The error occurred in ibatis-map.xml.  
--- The error occurred while applying a parameter map.  
--- Check the getEmpLoanDistribContribInfoMap.  
--- Check the output parameters (retrieval of output parameters failed).  
--- Cause: java.sql.SQLException: Cursor is closed.

我不相信问题实际上出在参数映射中,因为类似的代码适用于项目的其他区域,但我在这里包含了参数映射和存储的 proc 头以防万一。
<parameterMap id="getEmpLoanDistribContribInfoMap" class="map" >
    <parameter property="resultCode" javaType="int" jdbcType="NUMERIC" nullValue="-1" mode="OUT"/>
    <parameter property="client_id" javaType="int" jdbcType="NUMERIC" mode="IN"/>
    <parameter property="emp_nbr" javaType="int" jdbcType="NUMERIC" mode="IN"/>
    <parameter property="general_info" javaType="result" jdbcType="ORACLECURSOR" mode="OUT"/> 
    <parameter property="current_contrib_info" javaType="result" jdbcType="ORACLECURSOR" mode="OUT"/> 
    <parameter property="future_contrib_info" javaType="result" jdbcType="ORACLECURSOR" mode="OUT"/> 
    <parameter property="distrib_info" javaType="result" jdbcType="ORACLECURSOR" mode="OUT"/> 
    <parameter property="loan_info" javaType="result" jdbcType="ORACLECURSOR" mode="OUT"/> 
</parameterMap>
function get_emp_ldc_info (
  client_id                 employees.clt_id%type,
  emp_nbr                   employees.emp_nbr%type,
  general_info              out retire_ref_types.retire_ref_cursor,
  current_contrib_info      out retire_ref_types.retire_ref_cursor,
  future_contrib_info       out retire_ref_types.retire_ref_cursor,
  distrib_info              out retire_ref_types.retire_ref_cursor,
  loan_info                 out retire_ref_types.retire_ref_cursor
) return number is
  retval number;

上面 5 个游标中的每一个都为函数体中的选择打开。我提取了每个选择查询,并且所有查询都正常运行(尽管有些没有找到任何记录——这可能是我的问题吗?)。我什至创建了一个脚本来反射(reflect)这个函数,它在一个声明块中定义每个游标,并打开它们。没有遇到异常。

我意识到我的问题很可能是坏数据,但我不知道去哪里找。我唯一能想到的是,如果为找不到数据的选择打开了参数映射中的一个输出游标,我应该会收到此异常。有没有人知道这是不是真的?

最佳答案

我已经确认这是导致这种情况的错误数据。我仍然没有找到它在哪里,但我正在回答这个问题,所以没有人在这上面浪费时间。谢谢阅读。

关于sql - 应用参数映射时 iBatis 错误 - 由 SQLException : Cursor is closed 引起,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3257433/

相关文章:

c# - 加载表单后自定义光标消失/停止工作秒

iphone - 如何从经度/纬度获取附近的位置?

sql - 从 friend 那里获取帖子(您有权查看)

sql - 使用循环 Oracle 为每个 ID 遍历的完整路径

java - 无法识别的选项 : -MaxMetaspaceSize=256m

android - 你能用我的代码找出错误吗?

java - Sqlite 数据抽象到布局

sql - 首先提交;提交两个事务

php - 对列进行分组

database - Oracle 数据泵 impdp 到远程服务器