[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2811) ScrollableResults.next() generates Exception when no records were found and ScrollMode.FORWARD_ONLY is used

Gail Badner (JIRA) noreply at atlassian.com
Wed Sep 26 13:50:57 EDT 2007


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

Gail Badner commented on HHH-2811:
----------------------------------

Please attach a runnable test case (i.e., Java and mappings).

> ScrollableResults.next() generates Exception when no records were found and ScrollMode.FORWARD_ONLY is used
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: HHH-2811
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2811
>             Project: Hibernate3
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.2.0.ga
>         Environment: Oracle database  9.2.0.5.0; Oracle jdbc driver 10.2.0.2.0; JBoss 4.0.4.GA; Hibernate 3.2.0.ga
>            Reporter: Simon Jongsma
>
> When using ScrollableResults with ScrollMode.FORWARD_ONLY 
> i could not locate a way to test (without triggering an exception) if there are any records found.
> If the set is empty the next() function generates (on first call) a 
> GenericJDBCException: "could not perform sequential read of results (forward)".
> It should return the boolean false value instead.
> When there are data found the next() function will work ok & 
> also will correctly return false when reaching the end of the set.
> A workaround (kludge) is to catch the Exception like this:
> ScrollableResults foundRecs = query.scroll(ScrollMode.FORWARD_ONLY); 
> try {
> 	boolean found = foundRecs.next();
> } catch (GenericJDBCException e) { 
> 	   if (e.getMessage().equalsIgnoreCase("could not perform sequential read of results (forward)")) {
> 	     found = false;}
> 	   else throw new DatabaseException(e.getMessage(), e);
> }	
> if (found) ....

-- 
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