We're updating the issue view to help you get more done. 

FORWARD_ONLY ScrollableResults#next() throw GenericJDBCException

Description

I use ScrollableResults fetch Join set ScrollMode.FORWARD_ONLY.
In this case, ScrollableResults#next() throw GenericJDBCException.

Error Message is

org.hibernate.exception.GenericJDBCException: could not perform sequential read of results (forward)
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:91)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:79)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.Loader.loadSequentialRowsForward(Loader.java:386)
at org.hibernate.impl.FetchingScrollableResultsImpl.next(FetchingScrollableResultsImpl.java:55)
...
Caused by: java.sql.SQLException: Invalid operation for forward only resultset : first
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
at oracle.jdbc.driver.BaseResultSet.first(BaseResultSet.java:74)
at org.hibernate.loader.Loader.loadSequentialRowsForward(Loader.java:366)
... 29 more

org.hibernate.loader.Loader#loadSequentialRowsForward() method is

if ( resultSet.isBeforeFirst() ) {
resultSet.first();
}

but , I think that should use resultSet.next()

if ( resultSet.isBeforeFirst() ) {
resultSet.next();
}

Environment

Hibernate 3.1
Oracle10gR2
Oracle JDBC Driver 10.2.0.1.0
Sun JDK 1.5.0_06
Spring 1.2.6

Status

Assignee

Steve Ebersole

Reporter

Masahiro Hirashima

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

3.1

Priority

Major