Hi,
I guess there is a misunderstanding. Most likely the bug was that H2
did return rows for the query, but it shouldn't. Due to some other bug
or incompatibility which was fixed later on.
>> Not sure if you looked at the Hibernate test, but the very first thing
>> this test does is to execute an initial query which simply checks the
>> number of results ensuring we got back zero.
As far as I see, the first line where this Hibernate test checks it
got back zero rows is line 68. The test does:
63: ScrollableResults results = s.createQuery( query ).setString(
"desc", "root%" ).scroll();
65: assertFalse( results.isFirst() );
66: assertFalse( results.isLast() );
68: assertFalse( results.next() );
As far as I see, ScrollableResultsImpl.isFirst() just calls
ResultSet.isFirst(), and ScrollableResultsImpl.isLast() just calls
ResultSet.isLast(). Both methods return false no matter how many rows
are in the result set, as long as the results.next() is not yet
called. My test case:
public static void main(String... args) throws Exception {
Class.forName("org.h2.Driver");
Connection conn = DriverManager.getConnection("jdbc:h2:mem:");
ResultSet rs = conn.createStatement().executeQuery("select * from dual");
System.out.println(rs.isFirst());
System.out.println(rs.isLast());
System.out.println(rs.next());
conn.close();
}
Result:
false
false
true
Regards,
Thomas