Trying to do streaming of an entity which has a collection (@OneToMany) with a criteria specifying a fetchType, hibernate uses org.hibernate.loader.Loader#loadSequentialRowsForward to do the fetching where calls ResultSet#isAfterLast Checking isAfterLast javadoc it says when using streaming (TYPE_FORWARD_ONLY) support is OPTIONAL. So it seems that mariadb guys took that seriously and doesn't have support.
/**
* 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;
I've attached a piece of code reproducing this case. I have alse 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 Is it possible to replace the call to a method that is defined as optional when using a flag that is required for streaming? |