如何在MyBatis中调用返回Oracle记录类型的Oracle函数

时间:2012-09-05 12:26:36

标签: java oracle spring mybatis

我在包规范中有记录类型:

 TYPE Payment_Capabilities IS RECORD(
    pp_partial_payment NUMBER(1) DEFAULT 0,
    co_advance_payment NUMBER(1) DEFAULT 0,
    dp_deposit_payment NUMBER(1) DEFAULT 0,
    dr_deposit_repay   NUMBER(1) DEFAULT 0,
    wp_wallet_payment  NUMBER(1) DEFAULT 0,
    wr_wallet_repay    NUMBER(1) DEFAULT 0,
    ss_prepaid_payment NUMBER(1) DEFAULT 0);

和返回此类型的函数。我正在使用MyBatis与Spring集成。如何调用(使用MyBatis XML Mapper)此函数并将结果映射到POJO对象?

1 个答案:

答案 0 :(得分:0)

<select id="identifyPaymentCapabilities" parameterType="PaymentCapabilities" statementType="CALLABLE">
    DECLARE
        v_payment_capabilities APS.Payment_Capabilities;
    BEGIN
        v_payment_capabilities := APS.get_payment_capabilities(#{customerId, javaType=Integer, jdbcType=NUMERIC, mode=IN});

        #{partialPaymentPP, javaType=Integer, jdbcType=NUMERIC, mode=OUT} := v_payment_capabilities.pp_partial_payment;
        #{advancePaymentCO, javaType=Integer, jdbcType=NUMERIC, mode=OUT} := v_payment_capabilities.co_advance_payment;
        #{depositPaymentDP, javaType=Integer, jdbcType=NUMERIC, mode=OUT} := v_payment_capabilities.dp_deposit_payment;
        #{depositRepayDR,   javaType=Integer, jdbcType=NUMERIC, mode=OUT} := v_payment_capabilities.dr_deposit_repay;
        #{walletPaymentWP,  javaType=Integer, jdbcType=NUMERIC, mode=OUT} := v_payment_capabilities.wp_wallet_payment;
        #{walletRepayWR,    javaType=Integer, jdbcType=NUMERIC, mode=OUT} := v_payment_capabilities.wr_wallet_repay;
        #{prepaidPaymentSS, javaType=Integer, jdbcType=NUMERIC, mode=OUT} := v_payment_capabilities.ss_prepaid_payment;
    END;
</select>