我有一个不包含任何 GROUP_CONCAT() 调用的批量更新函数;
UPDATE
product
SET
viewed = ?
WHERE
product_id = ?
如您所见,这是一个准备好的声明。我正在设置它的值,然后使用 addBatch() 方法为每一行添加它。当我的计数达到定义的限制(1000)时,我正在调用 executeBatch() 以进行数据库修改。如您所见,在我的批量更新过程中没有 group_concat() 调用,但 mysql jdbc 抛出此异常。批量更新和 group_concat() 的隐藏关系是什么,为什么?我能做些什么来解决这个问题?减少批次限制或增加 group_concat() 限制?
我的堆栈跟踪是;
java.sql.BatchUpdateException: Row 276751 was cut by GROUP_CONCAT()
at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:2054)
at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:1467)
at datasource.DB.execPreparedStatement(DB.java:480)
at datasource.DB.addBatch(DB.java:467)
at cj.reportsummarydaily.ProductViewed.executeJob(ProductViewed.java:24)
at job.Job.executeCore(Job.java:101)
at job.Job.execute(Job.java:77)
at cj.reportsummarydaily.Main.executeJobMeta(Main.java:35)
at job.JobMeta.execute(JobMeta.java:32)
at cronjob.CronJob.main(CronJob.java:66)
Caused by: java.sql.SQLException: Row 276751 was cut by GROUP_CONCAT()
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1078)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4187)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4119)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2570)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2731)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2815)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2155)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2458)
at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:2006)
... 9 more