It appears that the MySQL Connector has made some changes which may or may not be correct. They are however breaking batch inserts when When rewriteBatchedStatements=true
On code that works fine with Hibernate 4.1.6 and ConnectorJ 5.1.22 I get the following error when moving to ConnectorJ 5.1.29
Caused by: org.hibernate.jdbc.BatchedTooManyRowsAffectedException: Batch update returned unexpected row count from update [0]; actual row count: 53; expected: 1
It appears that the connector is now returning the actual number of inserted rows rather than a constant 1.
The Release notes for 5.1.27 show the following
Quote:
When rewriteBatchedStatements=true and useAffectedRows=true were set, executeBatch() did not return the number of affected rows as expected. (Bug #16442951, Bug #68562)
http://bugs.mysql.com/bug.php?id=68562
http://bugs.mysql.com/bug.php?id=71528
Has anyone else run into this? Turning off rewriteBatchedStatements is an option but that drops performance.