首页 > 解决方案 > 春季批处理阅读器中的读取计数小于源计数

问题描述

我正在使用 Spring Batch with Spring Boot。从源读取表并写入目标。我正在填充三个表,其中一个表的读取计数小于实际值。

说在源表中有 2656274 行但我得到的读取计数是 readCount=2577203, writeCount=2577203

其他有 8 个缺少记录和 10 k 记录工作正常的表

public class DxDatabaseItemReader extends JdbcCursorItemReader<DxDataRead> {

    public  DxDatabaseItemReader(DxJobContext jobCntx) {
        synchronized (this){
        System.err.print("Into DxDatabaseItemReader");
        String[] dsParam =jobCntx.srcDbName.split("#");
        this.setDataSource(createOracleDataSource(dsParam[1],dsParam[2],dsParam[3]));
        this.setSql(createFetchQuery(jobCntx.srcFieldNames,jobCntx.srcTableName));//"SELECT SOEID, FST_NAM, LST_NAM FROM REF_PRSNL_MSTR");
        this.setFetchSize(0);
        this.setRowMapper((ResultSet rs, int rowNum) -> {
            Map<String, String> fieldNameMap = new HashMap<>();
            for(int i=0;i<jobCntx.srcFieldNames.size();i++)
                fieldNameMap.put(getSrcFieldName(jobCntx.srcFieldNames, i), rs.getString(jobCntx.srcFieldNames.get(i)));
            DxDataRead dataRead = new DxDataRead();
            dataRead.setFieldNameMap(fieldNameMap);
            return dataRead; 

            });
        }
    }

预期:它应该读取所​​有数据并写入

标签: spring-bootspring-batch

解决方案


推荐阅读