ARTICLE DETAIL

资讯详情

深耕网站建设与运营推广的一线实战洞察。

mybatis 数据库批量操作的调试技巧

mybatis 数据库批量操作的调试技巧 数据库批量操作时报错经常无法定位到具体是那条记录导致的方法是 捕获异常后再遍历数据集单条执行再次捕获异常,这样就容易找到异常的原因l。try {long beginTime2 System.currentTimeMillis();lmdsYxLkjRealService.updateBatchById(realInfoList);log.info(real表批量更新耗时(System.currentTimeMillis() - beginTime2) 毫秒更新条数:realInfoList.size());}catch(Exception e){log.error(real表批量更新出错了e.getMessage(),e);for(LmdsYxLkjReal object:realInfoList){try {lmdsYxLkjRealService.updateById(object);}catch(Exception e1){log.error(object id object.getId() ; object.getLocoTypeid() - object.getLocoNo() - object.getAbj());log.error(原始数据包是object.getSrcDataHexStr());}}}
返回列表