From derby-dev-return-59576-apmail-db-derby-dev-archive=db.apache.org@db.apache.org Thu May 01 20:58:47 2008 Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 42635 invoked from network); 1 May 2008 20:58:47 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 1 May 2008 20:58:47 -0000 Received: (qmail 54655 invoked by uid 500); 1 May 2008 20:58:44 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 54624 invoked by uid 500); 1 May 2008 20:58:44 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 54603 invoked by uid 99); 1 May 2008 20:58:44 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 May 2008 13:58:44 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 May 2008 20:58:07 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id DFA2A234C11B for ; Thu, 1 May 2008 13:54:55 -0700 (PDT) Message-ID: <530248841.1209675295914.JavaMail.jira@brutus> Date: Thu, 1 May 2008 13:54:55 -0700 (PDT) From: "Kristian Waagan (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Resolved: (DERBY-3397) Derby 10.3.1.4 and 10.3.2.1 break scrollable result sets? Hibernate Query.setFirstResult and/or setMaxResults In-Reply-To: <17694451.1202452148128.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/DERBY-3397?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Kristian Waagan resolved DERBY-3397. ------------------------------------ Resolution: Fixed Fix Version/s: 10.4.1.4 10.3.2.2 Backported the fix and test to 10.4 with revision 652656 and the fix only to 10.3 with revision 652657. I did not backport the test to 10.3 because some code related to the JUnit test framework did not compile. Should be easy to correct, but I want the fix in before the imminent 10.3 update release is produced. All regression tests ran cleanly for both 10.3 and 10.4. Resolving issue, leaving it up to the reporter to close when the fix has been confirmed. > Derby 10.3.1.4 and 10.3.2.1 break scrollable result sets? Hibernate Query.setFirstResult and/or setMaxResults > ------------------------------------------------------------------------------------------------------------- > > Key: DERBY-3397 > URL: https://issues.apache.org/jira/browse/DERBY-3397 > Project: Derby > Issue Type: Bug > Components: JDBC > Affects Versions: 10.3.1.4, 10.3.2.1, 10.4.1.4, 10.5.0.0 > Environment: Derby 10.3.1.4 and 10.3.2.1, Hibernate 3.2.5 > Reporter: Michael Lossos > Assignee: Dag H. Wanvik > Fix For: 10.3.2.2, 10.4.1.4, 10.5.0.0 > > Attachments: derby-3397-2a-junit_reg_test.diff, DERBY-3397-reproduction-case.zip, derby-3397.diff > > > I am attempting to upgrade our product from Derby 10.2.2.0 to 10.3.2.1. With all other things held constant, if I change the derby.jar from 10.2.2 to 10.3.2.1, our calls to set the (JDBC) first result and max results (max rows) no longer function properly, such that no results are returned beyond first result 200, max results 100 (max rows 300), even when the table has over 1000 rows. 2 of the 11 columns of this table are indexed > We use Hibernate's result pagination via Query.setFirstResult and setMaxResults which, in org.hibernate.loader.Loader.advance(), uses java.sql.ResultSet.advance when scrollable result sets are available, and as expected org.apache.derby.impl.jdbc.EmbedDatabaseMetaData reports that scrollable result sets are available for both Derby 10.2.2 and 10.3.2.1. > The following is pseudo code for what we're doing with Hibernate: > int pageSize = 100; > int count = ... // select count(*) from OURTABLE; > for( int firstResult = 0; firstResult < count; firstResult += pageSize) { > Query query = session.createQuery( "from OurHibernateObject"); // select * from OURTABLE > query.setFirstResult( firstResult ); > query.setMaxResults( pageSize ); > List objList = query.list(); > // results are fine for firstResult 100 and 200, > // but beyond that no results are returned with a >1000 row table! > } > When settings max results, Hibernate correctly sets max rows as follows from org.hibernate.loader.Loader.setMaxRows: > st.setMaxRows( selection.getMaxRows().intValue() + getFirstRow( selection ) ); > Which is calling into org.apache.derby.impl.jdbc.EmbedPreparedStatement40. This code path doesn't change between Derby 10.2.2 and 10.3.2.1. > I've tried completely recreating the database to remove any possible problems with soft / full upgrades, but this didn't fix the problem. I tried 10.3.1.4 but this also exhibits the bug. > This seems like a fairly basic regression (surely a Derby test would fail if scrollable results were broken). I'm wondering if there's another factor at work here? Please help me to describe whatever else is necessary for you to reproduce this. (I can't post our table schema or our code.) I apologize in advance if this our own mistake but as I said, I'm only updating the derby.jar. > Thanks for all the hard work on Derby! -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.