[CONJ-157] Batch statements rewrite has broken the hibernate functionality Created: 2015-05-22  Updated: 2015-06-23  Resolved: 2015-06-23

Status: Closed
Project: MariaDB Connector/J
Component/s: Other
Affects Version/s: 1.1.8
Fix Version/s: 1.1.9

Type: Bug Priority: Major
Reporter: Saravanan Muthusamy Assignee: Diego Dupin
Resolution: Fixed Votes: 1
Labels: None
Environment:

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.



 Comments   
Comment by Diego Dupin [ 2015-05-29 ]

Your code is good , julien PIvotto.
I've just report it on master without the changed indentation to see only what as been changed.
I haven't think a moment that you'll not be seen as author.

Sorry, you have all the credit for this code !

Comment by Julien Pivotto [ 2015-05-29 ]

Hello, the main problem is not the authorship but the git log readability. We provided a complete git commit message.

Thank you for the clarification about the indentation.

Generated at Thu Feb 08 03:13:35 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.