org.springframework.dao.InvalidDataAccessResourceUsageException: Unexpected cursor position change. ...

在用SpringBatch 跑job的时候出现这个错误, 由于取数据的DB 是netezza, 框架可能支持的不是很全面,当然也可能是其他原因。

<bean id="reader_rdc"
        class="org.springframework.batch.item.database.JdbcCursorItemReader"
        scope="step">
        <property name="dataSource" ref="rdc-datasource" />
        <property name="sql">
            <value>
                <![CDATA[
                    SELECT DISTINCT
                    C.SAP_CUSTOMER_NO,
                    case
                    WHEN  C.SAP_CUSTOMER_NO > 1 THEN  C.SAP_CUSTOMER_NO + 10000000000
                    END AS  SAP_CUSTOMER_NO_11_POS,
                      G.IOT_NAME,
                      --G.IMT_NAME,
                      CASE
                        WHEN G.ISO_COUNTRY_NAME = 'United States' THEN 'United States'
                        ELSE  G.IMT_NAME
                      END AS  IMT_NAME,
                      G.ISO_COUNTRY_NAME,
                      C.ISSUING_COUNTRY_NO,
                      C.SAP_DIM_ISO_COUNTRY_CODE,
                      C.MANDT,
                      C.CUST_NAME,
                      C.STREET_ADDRESS,
                      C.CUST_CITY,
                      C.CUST_STATE_PROV,
                      C.CUST_NO,
                      LENGTH(C.CUST_NO) AS CUST_NUM_LENGTH,
                      C.CUST_COUNTY_CODE,
                      H.DUNS_NO,
                      C.ENTERPRISE_NO,
                      C.MKT_AFFILIATE_NO,
                      C.DOM_CLIENT_ID,
                      SUBSTRING(C.GBL_BUY_GRP_ID,1,2) AS GBG_Mnemonic,
                      '1' AS RECORD_COUNT,
                      F.LEGAL_DOM_CLIENT_NAME, -- FROM  SAPR3.LEGAL_DOM_CLIENT
                      C.GBL_CLIENT_ID,
                      C.GBL_ULT_CLIENT_ID,
                      C.DOM_BUY_GRP_ID,
                      C.GBL_BUY_GRP_ID,
                      C.SAP_DIM_BASE_TYPE,
                      C.SAP_DIM_BASE_COVID,
                      B.COV_CLIENT_TYPE,
                      D.COV_CLIENT_TYPE_DESC,
                      J.CAP_IND,
                      K.AUFSD AS ORDER_NO,
                      S.INDUSTRY_CODE,
                      S.INDUSTRY_NAME  
                    FROM CUST.SAP_COVERAGE_CUSTOMER C
                    LEFT OUTER JOIN CUST.SAP_DIM_COVERAGE A
                      ON C.SAP_DIM_BASE_COVID = A.COV_ID
                      AND C.SAP_DIM_BASE_TYPE = A.COV_TYPE
                    LEFT OUTER JOIN SAPR3.V_COVERAGE_ID_CLIENT_TYPE B
                      ON A.COV_TYPE = B.COVTYPE
                      AND A.COV_ID = B.COVID
                      AND C.MANDT = B.MANDT
                    LEFT OUTER JOIN NZCCMS.CUST_SAP_DIM_ISO_COUNTRY G
                      ON C.SAP_DIM_ISO_COUNTRY_CODE = G.ISO_COUNTRY_CODE
                    LEFT OUTER JOIN SAPR3.COVERAGE_CLIENT_TYPE D
                      ON  B.COV_CLIENT_TYPE = D.COV_CLIENT_TYPE
                      AND C.MANDT = D.MANDT
                    LEFT OUTER JOIN SAPR3.KDUNS H
                      ON C.MANDT = H.MANDT
                      AND C.SAP_CUSTOMER_NO = H.KUNNR
                    LEFT OUTER JOIN SAPR3.LEGAL_DOM_CLIENT F
                      ON C.DOM_CLIENT_ID = F.DOM_CLIENT_ID
                      AND C.MANDT = F.MANDT
                    LEFT OUTER JOIN SAPR3.KUNNR_EXT J
                      ON C.MANDT = J.MANDT
                      AND C.SAP_CUSTOMER_NO = J.KUNNR
                    LEFT OUTER JOIN SAPR3.KNA1 K
                      ON C.MANDT = K.MANDT
                      AND C.SAP_CUSTOMER_NO = K.KUNNR
                    LEFT OUTER JOIN NZCCMS.CUST_SAP_DIM_SIC_CODE S
                      ON C.SAP_DIM_UNSIC_CODE = S.UNSIC_CODE
                    WHERE
                    J.CAP_IND= 'Y'
                    AND C.MANDT = '100'
                    AND K.AUFSD NOT IN('75','90','93')
                    AND B.COV_CLIENT_TYPE IN ('R','C','E','D')
                ]]>
            </value>
        </property>
        <property name="rowMapper">
            <bean class="flow.RdcMapper" />
        </property>
        <property name="verifyCursorPosition">
            <value>false</value>
        </property>
    </bean>

将 verifyCursorPosition 属性设成 false 即可。

转载于:https://www.cnblogs.com/changfangxing/p/5920361.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值