cannot receive out parameter from oracle procedure executed by mybatis

前端 未结 1 1131
臣服心动
臣服心动 2020-12-10 19:06

I develop java application using Spring 3.0.5 and I work with database Oracle using mybatis-spring.

I\'ve an interface for mybatis:

public interface          


        
相关标签:
1条回答
  • 2020-12-10 19:17

    I found solution. Map must be user instead of two parameter in canCustomerSubscribe method.

     void canCustomerSubscribe(Map<String,Object> params);
    

    mybatis xml content:

    <select id="canCustomerSubscribe" parameterType="java.util.HashMap" statementType="CALLABLE">
        CALL wallet.pkg_wallet_validation.can_customer_subscribe(
        #{msisdn, jdbcType=VARCHAR, javaType=java.lang.String, mode=IN},
        #{responseCode,jdbcType=NUMERIC, javaType=java.lang.Integer, mode=OUT})
    </select>
    

    (I need to add the commas between arguments attributes)

    calling it from subscribe service method:

    public void subscribe(String msisdn) throws InvalidArgumentException {
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("msisdn", msisdn);
        params.put("responseCode", null);
        subscriberMapper.canCustomerSubscribe(params);
        System.out.println(params.get("responseCode"));
    }
    
    0 讨论(0)
提交回复
热议问题