Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CONJ-157 Fix the executeBatch return value when rewriteBatchedStateme… #10

Closed
wants to merge 1 commit into from

Conversation

smuthusa
Copy link

…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!.

…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!.
@rusher rusher closed this May 28, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants