CONJ-157 Fix the executeBatch return value when rewriteBatchedStateme… #10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
…nts are enabled
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.
Fix:
Correcting the implementation to return the result set(array) as the size of commands included in the batch. The value of individual entries in the result set will be either 1 or SUCCESS_NO_INFO. if the updatecount received from MariaDB server is same as batch size then 1 otherwise SUCCESS_NO_INFO.
Note: This behavior is applicable only when rewriteBatchedStatements enabled!.