[CONJ-418] Implement ResultSet#isAfterLast when flag TYPE_FORWARD_ONLY is on Created: 2017-01-27  Updated: 2017-02-07  Resolved: 2017-02-06

Status: Closed
Project: MariaDB Connector/J
Component/s: Other
Affects Version/s: 1.5.7
Fix Version/s: 1.5.8

Type: Task Priority: Major
Reporter: Federico Gaule Assignee: Diego Dupin
Resolution: Fixed Votes: 0
Labels: None

Attachments: Zip Archive hibernate_streaming_mariadb.zip    

 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



 Comments   
Comment by Diego Dupin [ 2017-02-06 ]

will be on 1.5.8 release (end of the week)

Comment by Federico Gaule [ 2017-02-07 ]

Thanks!

Generated at Thu Feb 08 03:15:31 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.