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

Batched Queries failing to be validated by Hibernate

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 2.1.0, 2.1.1
    • 1.6.5, 2.1.2
    • batch
    • None

    Description

      PreparedStatement st = connection.prepareStatement("delete from temp_t where col1 = ?");
      st.setInt(1, 0);
      st.addBatch();
      st.setInt(1, 1);
      st.addBatch();
      int[] ints = st.executeBatch();

      When I run Batched Queries in 1.6.4 or 2.0.3 I got two results, exactly what I expect;
      ints =

      {1, 1}

      When the same code ran in 2.1.0 or 2.1.1
      I got unexpected first value -3, so that my array looks like this:
      ints = {-3, 1, 1}

      In case if newer driver used with Hibernate, we face fail, since it traverse through whole array and throw Exception on negative values - it's in this class

      org.hibernate.engine.jdbc.batch.internal.BatchingBatch.checkRowCounts()

      Attachments

        Activity

          I believe "return;" after this line
          https://github.com/MariaDB/mariadb-connector-j/blob/master/src/main/java/org/mariadb/jdbc/internal/com/read/dao/Results.java#L222

          Could solve the issue, but is it safe - I don't know

          yerenkow Oleksandr Ierenkov added a comment - I believe "return;" after this line https://github.com/MariaDB/mariadb-connector-j/blob/master/src/main/java/org/mariadb/jdbc/internal/com/read/dao/Results.java#L222 Could solve the issue, but is it safe - I don't know
          diego dupin Diego Dupin added a comment - - edited

          you PR will correct that (https://github.com/MariaDB/mariadb-connector-j/pull/112).

          At the same time, I'll create an issue server side, there is no reason for delete to be not possible.
          The BULK protocol must normally throw exception only for SELECT queries in batch ( like JDBC require), not DELETE commands.

          diego dupin Diego Dupin added a comment - - edited you PR will correct that ( https://github.com/MariaDB/mariadb-connector-j/pull/112 ). At the same time, I'll create an issue server side, there is no reason for delete to be not possible. The BULK protocol must normally throw exception only for SELECT queries in batch ( like JDBC require), not DELETE commands.
          diego dupin Diego Dupin added a comment -

          Merge done, available through SNAPSHOT's :

          <repositories>
              <repository>
                  <id>sonatype-nexus-snapshots</id>
                  <name>Sonatype Nexus Snapshots</name>
                  <url>https://oss.sonatype.org/content/repositories/snapshots</url>
              </repository>
          </repositories>
           
          <dependencies>
              <dependency>
                  <groupId>org.mariadb.jdbc</groupId>
                  <artifactId>mariadb-java-client</artifactId>
                  <version>2.1.2-SNAPSHOT</version>
              </dependency>
          </dependencies>
          
          

          release in a few days.

          diego dupin Diego Dupin added a comment - Merge done, available through SNAPSHOT's : <repositories> <repository> <id>sonatype-nexus-snapshots</id> <name>Sonatype Nexus Snapshots</name> <url>https: //oss.sonatype.org/content/repositories/snapshots</url> </repository> </repositories>   <dependencies> <dependency> <groupId>org.mariadb.jdbc</groupId> <artifactId>mariadb-java-client</artifactId> <version> 2.1 . 2 -SNAPSHOT</version> </dependency> </dependencies> release in a few days.

          People

            diego dupin Diego Dupin
            yerenkow Oleksandr Ierenkov
            Votes:
            0 Vote for this issue
            Watchers:
            2 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.