Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
1.1.8
-
None
-
OS: Linux
java version "1.7.0_79"
MariaDB version : 10.0.17
Description
The batch insertion feature implemented in MariaDB connector 1.1.8(requirement CONJ-99) has broken the hibernate code. when rewriteBatchedStatements enabled, MariaDB connector will rewrite multiple insert commands(INSERT INTO table_xyz VALUES(0, 'val0'), INSERT INTO table_xyz VALUES(1, 'val1')) to a long insert(INSERT INTO table_xyz VALUES(0, 'val0'), (1, 'val1')).
The problem is with the return value(array returned from MariaDB connector) of executeBatch, whose size is always 1. But Hibernate expects the result array size same as the batch size. This is valid from hibernate perspective as it expects according to the API standard.
The proposal is to correct the implementation in MariaDB client based on the standard. We have corrected the implementation to return the result set to include the status for all the commands in the batch. Changes are available in the GitHub.
Here is the sample test written to reproduce the issue with hibernate https://github.com/smuthusa/issues. Change the Database configurations in test-applicationcontext.xml and execute it with 'maven clean install' from hibernate-batch-update-with-mariadb-client.