解决报错Cause: java.lang.StringIndexOutOfBoundsException: String index out of range: 609

Cause: java.lang.StringIndexOutOfBoundsException: String index out of range: 609

这个原因是由于Mybatis 插入数据报错:

org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.executor.ExecutorException: Error preparing statement. Cause: java.lang.StringIndexOutOfBoundsException: String index out of range: 609
原因:批量插入的时候,List没有判空导致的。

解决方法:

加一个非空判断即可

if (!CollectionUtils.isEmpty(positionRelAddDTO.getPositionIdList())){
positionDao.insertBatchRelation(positionRelAddDTO);
}
posted @ 2023-03-28 15:27  Tk小武  阅读(546)  评论(0编辑  收藏  举报