HQL Query with fetch causes exception if no rows selected be query (java.sql.SQLException:
Exhausted Resultset )
----------------------------------------------------------------------------------------------------------------
Key: HHH-2293
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2293
Project: Hibernate3
Type: Bug
Components: core
Versions: 3.2.2
Environment: Oracle 10g2 (10.2.0.2.0) Hiberbate 3.2.0
Reporter: Andriy Solonchuk
After executing next query
select p from ProductHibernate p left join FETCH p.productSomeCollection
where 1=2 /* that will cause NO rows returned*/
we will have exception
org.hibernate.exception.GenericJDBCException: could not perform sequential read of results
(forward)
at
org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
...
Caused by: java.sql.SQLException: Exhausted Resultset
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
...
at org.hibernate.loader.Loader.getKeyFromResultSet(Loader.java:1088)
at org.hibernate.loader.Loader.loadSequentialRowsForward(Loader.java:375)
... 24 more
If we will review code of Loader.java class we can see next
if ( resultSet.isAfterLast() ) {
// don't even bother trying to read further
return null;
}
if ( resultSet.isBeforeFirst() ) {
resultSet.next();
}
So at this step there are no checking if resultSet has any rows...
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira