Looks like Query scrolling via the scroll() method now works in Hibernate 2.1.6, which is nice.
One of the motivations for this feature, I believe, is to allow one to iterate through large result sets without loading all data into the JVM at once.
Unfortunately, the current implementation of scroll(), which uses a prepared statement with ResultSet.TYPE_SCROLL_INSENSITIVE, doesn't help matters when using Oracle 9i's JDBC driver. Oracle JDBC driver caches scrollable results sets in the JVM.
An alternative is to allow for forward-only scrolling. I imagine that a new method, Query.scroll(boolean), could be implemented to allow the user to specify whether the result set should be forward-only rather than scroll-insensitive. Of course, some refactoring of the ScrollableResults interface would be required since it would not be possible to "retreat" when scrolling through a forward-only result set.
Does this merit filing a JIRA issue?
|