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

Implement ResultSet#isAfterLast when flag TYPE_FORWARD_ONLY is on

Details

    • Task
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 1.5.7
    • 1.5.8
    • Other
    • None

    Description

      Streaming results from database using hibernate fails when ResultSet#isAfterLast is called when there is no more rows to read.

        /**
           * Retrieves whether the cursor is after the last row in
           * this <code>ResultSet</code> object.
           * <p>
           * <strong>Note:</strong>Support for the <code>isAfterLast</code> method
           * is optional for <code>ResultSet</code>s with a result
           * set type of <code>TYPE_FORWARD_ONLY</code>
           *
           * @return <code>true</code> if the cursor is after the last row;
           * <code>false</code> if the cursor is at any other position or the
           * result set contains no rows
           * @exception SQLException if a database access error occurs or this method is
           *            called on a closed result set
           * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
           * this method
           * @since 1.2
           */
          boolean isAfterLast() throws SQLException;
      

      Besides it says it is optional, seems that most used drivers, like mysql, have it working.

      I've attached a piece of code reproducing this case. I have also test it using mysql and h2, and in those cases it works.
      NOTE: you need to define a database hostname, database, user and pass in persistence.xml

      Attachments

        Activity

          fgaule Federico Gaule created issue -
          diego dupin Diego Dupin made changes -
          Field Original Value New Value
          Status Open [ 1 ] In Progress [ 3 ]
          diego dupin Diego Dupin made changes -
          Fix Version/s 1.5.8 [ 22509 ]
          diego dupin Diego Dupin added a comment -

          will be on 1.5.8 release (end of the week)

          diego dupin Diego Dupin added a comment - will be on 1.5.8 release (end of the week)
          diego dupin Diego Dupin made changes -
          Component/s Other [ 12201 ]
          Resolution Fixed [ 1 ]
          Status In Progress [ 3 ] Closed [ 6 ]

          Thanks!

          fgaule Federico Gaule added a comment - Thanks!
          serg Sergei Golubchik made changes -
          Workflow MariaDB v3 [ 79415 ] MariaDB v4 [ 128334 ]

          People

            diego dupin Diego Dupin
            fgaule Federico Gaule
            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.