sqlserver插入2892条出错

haogexiaole 2018-11-23 10:21:20
//batchLastIndex小于size本身customerAllList 75 batchCount 20 batchLastIndex 20
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.SIMPLE);
sqlSession.insert("com.idengyun.module.customer.dao.NewlyIncreasedToNCDao.saveAllCustomerListToNC",
customerAllList.subList(i, batchLastIndex));
sqlSession.commit();
sqlSession.close();

<insert id="saveAllCustomerListToNC" parameterType="java.util.List"
useGeneratedKeys="true" keyProperty="id">
INSERT INTO [dbo].[custdoc] (
orgcode,
appcustcode,
custname,
custclass,
tel1,
ts,
status
)
VALUES
<foreach collection="list" item="m" index="index" separator=",">
(
#{ m.orgcode },#{ m.appcustcode },#{ m.custname },'C1',#{ m.tel1
},#{m.ts},'0'
)
</foreach>
</insert>
...全文
218 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
BUG胡汉三 2018-11-27
  • 打赏
  • 举报
回复
恭喜LZ找到答案,批量操作如果太多了,也是需要分批提交的
haogexiaole 2018-11-27
  • 打赏
  • 举报
回复
https://blog.csdn.net/haogexiaole/article/details/84377185
2891条就可以的,不是数据问题,因为插入条数太多
Nihility/ 2018-11-23
  • 打赏
  • 举报
回复
楼主 报错信息贴一下 估计应该是数据本身有问题,你可以试一试,把2892那条数据干掉,再试试。

67,512

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧