我正在使用带有 Mybatis 最新版本的 spring 3。
我正在尝试进行返回游标结果的过程调用,以下是我的代码
我的错误如下,任何帮助表示赞赏..
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:
### Error updating database. Cause: java.lang.NullPointerException
### The error may involve com.comcast.triage.dao.AccountDetailDao.getAccountDetail-Inline
### The error occurred while setting parameters
### SQL: { ? = call ABC.get_acc_info(?, ?, ?, ?) }
### Cause: java.lang.NullPointerException
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:73)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:364)
at $Proxy21.update(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.update(SqlSessionTemplate.java:250)
下面是dao接口
public interface AccountDetailDao {
void getAccountDetail(Map<String, Object> parameter);
}
以下是我的映射器 xml
<mapper namespace="com.dao.AccountDetailDao">
<resultMap id="accountDetailResult" type="accountDetail">
<result property="usid" column="usid" />
<result property="accountNumber" column="account_number" />
<result property="headendInEEg" column="headend_in_eeg" />
<result property="customerType" column="customer_type" />
<result property="corp" column="corp" />
</resultMap>
<update id="getAccountDetail" parameterType="map" statementType="CALLABLE">
{ #{o_acc_cur,jdbcType=CURSOR,mode=OUT,resultMap=accountDetailResult,javaType=java.sql.ResultSet} =
call ABC_TRI.get_acc_info(#{accountNumber,jdbcType=VARCHAR,mode=IN}, #{authGuid,jdbcType=VARCHAR,mode=IN}, #{mac,jdbcType=VARCHAR,mode=IN}, #{usid,jdbcType=VARCHAR,mode=IN}) }
</update>
mybatis 还包含别名的配置
<typeAlias type="com.comcast.triage.domain.AccountDetail" alias="accountDetail"/>
以下是我的 oracle 包程序签名
PROCEDURE get_acc_info(
i_account_number IN VARCHAR2,
i_auth_guid IN VARCHAR2,
i_mac IN VARCHAR2,
i_usid IN VARCHAR2,
o_acc_cur OUT SYS_REFCURSOR);
来电测试如下
@Autowired
私人 AccountDetailDao accountDetailDao;
@Test public void test() {
Map<String, Object> param = new HashMap<String, Object>();
param.put("i_account_number", null);
param.put("i_auth_guid", null);
param.put("i_mac", "0162014707802#0");
param.put("i_usid", null);
accountDetailDao.getAccountDetail(param);
Object obj =param.get("o_acc_cur");
Assert.assertTrue(true);
}