[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2811?page=c...
]
Simon Jongsma commented on HHH-2811:
------------------------------------
To be more specific the bug occurs when using ScrollableResults in combination with a
query like
"from Order ord left join fetch ord.lines" on a empty Order table.
This will use FetchingScrollableResultsImpl.next() which generates an exception.
A simple query like "from Order ord" uses ScrollableResultsImpl.next()
and that works correctly.
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
Attachments: BugDemo.zip
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira