Hibernate 执行十万级数据批量操作时遇到的错误 求大神!

森屿丶 2019-04-29 09:46:28
同步批量执行SQL插入语句 30分钟左右后报错信息如下:

[ERROR] 2019-04-28 13:24:28,652 org.c.event.def.AbstractFlushingEventListener - Could not synchronize database state with session org.hibernate.exception.GenericJDBCException: could not insert: [com.eplugger.netSearch.paper.entity.NetSearchPaper]

[ERROR] 2019-04-28 13:24:28,743 org.hibernate.transaction.JDBCTransaction - Could not toggle autocommit java.sql.SQLException: connection holder is null

Caused by: java.sql.SQLException: connection holder is null at com.alibaba.druid.pool.DruidPooledConnection.checkStateInternal(DruidPooledConnection.java:1140) at com.alibaba.druid.pool.DruidPooledConnection.checkState(DruidPooledConnection.java:1131) at com.alibaba.druid.pool.DruidPooledConnection.prepareStatement(DruidPooledConnection.java:333) at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:497) at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:94) at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:87) at org.hibernate.jdbc.AbstractBatcher.prepareBatchStatement(AbstractBatcher.java:218) at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2174) ... 139 more
...全文
124 2 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
游北亮 2019-04-29
  • 打赏
  • 举报
回复
大量数据插入,我是用单条sql,例如: String sql = "insert into tb(f1, f2)values(1,2),(3,4),(5,6)";
十八道胡同 2019-04-29
  • 打赏
  • 举报
回复
同步批量执行SQL 用批量拷贝的方法,BulkCopy 你是用啥方法

67,543

社区成员

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

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