Return-Path: Delivered-To: apmail-incubator-abdera-user-archive@locus.apache.org Received: (qmail 37553 invoked from network); 20 May 2008 18:01:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 20 May 2008 18:01:24 -0000 Received: (qmail 53882 invoked by uid 500); 20 May 2008 18:01:26 -0000 Delivered-To: apmail-incubator-abdera-user-archive@incubator.apache.org Received: (qmail 53872 invoked by uid 500); 20 May 2008 18:01:26 -0000 Mailing-List: contact abdera-user-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: abdera-user@incubator.apache.org Delivered-To: mailing list abdera-user@incubator.apache.org Received: (qmail 53859 invoked by uid 99); 20 May 2008 18:01:25 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 May 2008 11:01:25 -0700 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [209.124.50.160] (HELO a2s8.a2hosting.com) (209.124.50.160) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 May 2008 18:00:37 +0000 Received: from [204.19.213.64] (helo=Arrova001) by a2s8.a2hosting.com with esmtpa (Exim 4.68) (envelope-from ) id 1JyW8p-0006XK-4R; Tue, 20 May 2008 14:00:51 -0400 Reply-To: From: "Remy Gendron" To: Cc: =?iso-8859-1?Q?'R=E9my_Beaumont'?= , "'Martin Guay'" , Subject: Need hook in AbstractEntityCollectionAdapter for paging Date: Tue, 20 May 2008 14:00:45 -0400 Organization: Le Groupe Arrova Inc. Message-ID: <681E8623E3FF409C9FD53EE2A5BA0ACD@Arrova001> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_001D_01C8BA81.E7FFD5F0" X-Mailer: Microsoft Office Outlook 11 X-MIMEOLE: Produced By Microsoft MimeOLE V6.0.6001.18000 Thread-Index: Aci6o21I1S4GfJCgRC28pQVY9DuolQ== X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - a2s8.a2hosting.com X-AntiAbuse: Original Domain - incubator.apache.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - arrova.ca X-Source: X-Source-Args: X-Source-Dir: X-Virus-Checked: Checked by ClamAV on apache.org ------=_NextPart_000_001D_01C8BA81.E7FFD5F0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hello all, =20 To make paging as much an orthogonal feature as possible, w/r to the application code, I am not using the very good proposition from our = friends Chris and Bryon (http://www.mail-archive.com/abdera-user@incubator.apache.org/msg00525.ht= ml) . I may not always have to possibility to use an update sequence as I = will quite often work on legacy/existing database schemas. =20 I am relying instead on the native paging features of the underlying database, not requiring any injection into the SQL where clause. For instance, with Oracle I have this call to add paging: =20 /** * @see http://www.oracle.com/technology/oramag/oracle/06-sep/o56asktom.html */ @Override protected void addPaging(StringBuilder sql, MapSqlParameterSource params, ServiceContext context) { params.addValue("startIndex", context.getStartIndex());=20 params.addValue("endIndex", context.getStartIndex() + context.getMaxResults() - 1); =20 String prefix =3D "select * from ( select /*+ FIRST_ROWS(" + context.getMaxResults() + ") */ a.*, rownum r from ( "; =20 sql.insert(0, prefix); sql.append(" ) a where rownum <=3D :endIndex ) where r >=3D :startIndex"); } =20 My request: =20 I follow Tom Kyte (asktom) recommendation about paging. My Abdera glue = code alters my service layer context so that the application code believes it must retrieve n+1 entries instead of n. That way, I can easily know = (with a very low database cost) if there is the need for a next page link to be inserted into the feed. =20 I have overridden AbstractEntityCollectionAdapter.addFeedDetails() to = insert the paging links if necessary. =20 However, the FOM for a feed does not allow to remove entries from the collection (Feed.getEntries()). Remember, my glue code had the adapter retrieve one too many entries in getEntries(). =20 Hence, I would need an afterGetEntries(request, entries) called in the addFeedDetails() prior to the iteration to alter the returned pojo = entries (in my case remove the additional entry). =20 I don=92t want to require the application developer to call some method = in his getEntries(). =20 For now, I have copied and modified addFeedDetails() in its entirety in = my AbstractEntittyCollectionAdapter class to implement the afterGetEntries hook. =20 Can anyone recommend a better approach? If not, I will enter a JIRA for = this request. =20 Thank you again, =20 R=E9my ------=_NextPart_000_001D_01C8BA81.E7FFD5F0--