Return-Path: X-Original-To: apmail-cayenne-user-archive@www.apache.org Delivered-To: apmail-cayenne-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C13037998 for ; Tue, 26 Jul 2011 11:25:41 +0000 (UTC) Received: (qmail 55480 invoked by uid 500); 26 Jul 2011 11:25:41 -0000 Delivered-To: apmail-cayenne-user-archive@cayenne.apache.org Received: (qmail 55206 invoked by uid 500); 26 Jul 2011 11:25:36 -0000 Mailing-List: contact user-help@cayenne.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cayenne.apache.org Delivered-To: mailing list user@cayenne.apache.org Received: (qmail 55196 invoked by uid 99); 26 Jul 2011 11:25:33 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Jul 2011 11:25:33 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of garyjarrel@gmail.com designates 209.85.215.171 as permitted sender) Received: from [209.85.215.171] (HELO mail-ey0-f171.google.com) (209.85.215.171) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Jul 2011 11:25:28 +0000 Received: by eye22 with SMTP id 22so615727eye.30 for ; Tue, 26 Jul 2011 04:25:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=SBVHK8EtWE81Cv4MRmG5R+LCj78n+AbaFCDUcVaCr7E=; b=jDXNnAYgDCNI9MftrkHehaDrj3aQeikDoVgjd1ScDTYdTE78ZFzx2aEXzUdKMlN1tv im+Xpf1OliOnGl1zxHTEq9uAVU7p6gSCIcL951Gt8jLtyV3stcfb7HG64r9PO+Ph2PMB RcaIiT1v8VJPzaEf75CN756zHLMX2WgdOOuO8= MIME-Version: 1.0 Received: by 10.204.14.66 with SMTP id f2mr1954900bka.195.1311679506473; Tue, 26 Jul 2011 04:25:06 -0700 (PDT) Received: by 10.204.40.80 with HTTP; Tue, 26 Jul 2011 04:25:06 -0700 (PDT) In-Reply-To: References: <9D47CA9F-5628-48CC-A6E1-DDDE71A13A22@objectstyle.org> Date: Tue, 26 Jul 2011 21:25:06 +1000 Message-ID: Subject: Re: setFetchOffset & setFetchLimit issue From: Gary Jarrel To: user@cayenne.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Should I still lodge a Jira? Gary On Mon, Jul 25, 2011 at 8:02 PM, Gary Jarrel wrote: > I am not sure if this would fix it. I've just checked out the 3.0 > source code, applied the patch, built Cayenne and and ran my code > against it, and am having the same problem. > > Could it perhaps be because SQL Server 2008 does not have the offset > feature? Well at least not until SQL Server 2011 (based on > http://stackoverflow.com/questions/187998/row-offset-in-sql-server) or > should Cayenne be falling back to in memory limits and offsets? > > Gary > > On Sun, Jul 24, 2011 at 8:26 PM, Andrus Adamchik = wrote: >> I just found the Jira that I had in mind when answering your email: >> >> =A0https://issues.apache.org/jira/browse/CAY-1539 >> >> I just committed the patch to trunk. Still suspect your case may be rela= ted somehow. >> >> Andrus >> >> On Jul 23, 2011, at 10:56 AM, Gary Jarrel wrote: >> >>> I will do some more research to try to narrow down why this is >>> happening tomorrow and then post a Jira. >>> >>> I also removed DISTINCT and any ordering and query parameters and the >>> result is still the same. >>> >>> Gary >>> >>> On Thu, Jul 21, 2011 at 9:48 PM, Andrus Adamchik wrote: >>>> Hi Gary, >>>> >>>> the use of the API seems correct. Not sure what's the deal here. Could= be a bug. (wonder if DISTINCT combination with offset/limit is causing thi= s, as there is some in-memory processing involved). Could you please open a= Jira and include the contents of the prototype query. >>>> >>>> Andrus >>>> >>>> >>>> On Jul 20, 2011, at 5:52 PM, Gary Jarrel wrote: >>>>> Hi Guys, >>>>> >>>>> I have an issue with using setFetchOffset & setFetchLimit together >>>>> with SQL Server 2008 R2. >>>>> >>>>> Basically the code looks something like this: >>>>> >>>>> SelectQuery query =3D getPrototypeQuery().queryWithParameters(params,= true); >>>>> query.setFetchOffset(offset); >>>>> query.setFetchLimit(limit); >>>>> List result =3D getDataContext().performQuery(query); >>>>> >>>>> I would have thought that given for example offset 10 and limit 20 I >>>>> could get a subset of the data in the database. Yet the generated cod= e >>>>> that I get from the logs is as follows keeping in mind I am using >>>>> ordering and distinct: >>>>> >>>>> Page 1: Offset 0 Limit 25 >>>>> SELECT DISTINCT TOP 25 t0.DateSigned, t0.CustomerName, t0.DocsFolder, >>>>> t0.ExpiryDate, t0.CustomerID, t0.CreatedDate, t0.LocationAddress, >>>>> t0.RecordID, UPPER(t0.DateSigned) FROM dbo.ConsentForms t0 WHERE >>>>> t0.CustomerID =3D ? ORDER BY UPPER(t0.DateSigned) [bind: >>>>> 1->CustomerID:8] >>>>> =3D=3D=3D returned 25 rows. - took 26 ms >>>>> >>>>> The above works as expected however the code appears strange. >>>>> >>>>> Page 2: Offset 25 Limit 25 >>>>> SELECT DISTINCT TOP 25 t0.DateSigned, t0.CustomerName, t0.DocsFolder, >>>>> t0.ExpiryDate, t0.CustomerID, t0.CreatedDate, t0.LocationAddress, >>>>> t0.RecordID, UPPER(t0.DateSigned) FROM dbo.ConsentForms t0 WHERE >>>>> t0.CustomerID =3D ? ORDER BY UPPER(t0.DateSigned) [bind: >>>>> 1->CustomerID:8] >>>>> =3D=3D=3D returned 0 rows. - took 20 ms >>>>> >>>>> This already stops working >>>>> >>>>> Page: 3: Offset 50 Limit 25 >>>>> SELECT DISTINCT TOP 25 t0.DateSigned, t0.CustomerName, t0.DocsFolder, >>>>> t0.ExpiryDate, t0.CustomerID, t0.CreatedDate, t0.LocationAddress, >>>>> t0.RecordID, UPPER(t0.DateSigned) FROM dbo.ConsentForms t0 WHERE >>>>> t0.CustomerID =3D ? ORDER BY UPPER(t0.DateSigned) [bind: >>>>> 1->CustomerID:8] >>>>> =3D=3D=3D returned 0 rows. - took 20 ms. >>>>> >>>>> Basically the first page appears to be working fine, but nothing afte= rwards. >>>>> >>>>> I am not certain if I am using the combination of setFetchOffset and >>>>> setFetchLimit in a correct manner! >>>>> >>>>> Any assistance would be appreciated. Thank you! >>>>> >>>>> Gary >>>>> >>>> >>>> >>> >> >> >