[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2293) HQL Query with fetch causes exception if no rows selected be query (java.sql.SQLException: Exhausted Resultset )

Gail Badner (JIRA) noreply at atlassian.com
Mon Oct 15 17:25:38 EDT 2007


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2293?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_28433 ] 

Gail Badner commented on HHH-2293:
----------------------------------

Please attach a runnable test case (Java + mapping).

> 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
>          Issue Type: Bug
>          Components: core
>    Affects 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.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list