bug描述:
文件导入后采取的是批量导入模式,每行数据由22列组成,需要22个占位符。
oracle最多支持占位符为65536个,在超过之后会报异常。导入excel文件
3713行所需的占位符为81686个导致sql执行失败返回异常。
insert table error:
java.lang.ArrayTndexOutOfBoundsException:20
修复方案:每次批量执行1000行数据插入,分多批次执行完成。
int batchSize = 1000;
List<BlackList> batchInsert = new ArrayList<>(batchSize);
for (BlackListrecord : records) {
batchInsert.add(record);
if(batchInsert.size()==batchSize){
blackListMapper.batchInsert(batchInsert);
batchInsert.clear();
}
}
if(batchInsert.size()>0){
blackListMapper.batchInsert(batchInsert);
};
由此看来:导入、导出功能,大批量数据测试是有必要的。