Uploaded image for project: 'MariaDB Connector/J'
  1. MariaDB Connector/J
  2. CONJ-157

Batch statements rewrite has broken the hibernate functionality

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 1.1.8
    • 1.1.9
    • Other
    • 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.

      Attachments

        Activity

          People

            diego dupin Diego Dupin
            smuthusa Saravanan Muthusamy
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.