Return-Path: Delivered-To: apmail-roller-commits-archive@www.apache.org Received: (qmail 84904 invoked from network); 31 Oct 2008 16:15:39 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 31 Oct 2008 16:15:39 -0000 Received: (qmail 59223 invoked by uid 500); 31 Oct 2008 16:15:45 -0000 Delivered-To: apmail-roller-commits-archive@roller.apache.org Received: (qmail 59191 invoked by uid 500); 31 Oct 2008 16:15:45 -0000 Mailing-List: contact commits-help@roller.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@roller.apache.org Delivered-To: mailing list commits@roller.apache.org Received: (qmail 59182 invoked by uid 99); 31 Oct 2008 16:15:45 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 31 Oct 2008 09:15:45 -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; Fri, 31 Oct 2008 16:14:38 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 2A2EC234C258 for ; Fri, 31 Oct 2008 09:15:19 -0700 (PDT) Message-ID: <559493114.1225469719171.JavaMail.jira@brutus> Date: Fri, 31 Oct 2008 09:15:19 -0700 (PDT) From: "Anil Gangolli (JIRA)" To: commits@roller.apache.org Subject: [jira] Commented: (ROL-1756) getMostCommentedWeblogs() doesn't return most commented weblogs unless called with limit = -1 In-Reply-To: <408831015.1225469239910.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/roller/browse/ROL-1756?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14445#action_14445 ] Anil Gangolli commented on ROL-1756: ------------------------------------ It is unclear how to address this in a generic way if there is actually a fundamental JPA limitation here. The limitation stated is that JPA QL doesn't support an order by clause on an aggregated column. This needs further investigation. It may be possible to use a subquery. If there is really no generic way to address this in JPA, a specific site may be able to workaround this by defining an appropriate view and model object, thereby avoiding the need to order then redefining the query to order on the simple column value. Not sure how feasible this would be to support generically over multiple database types. > getMostCommentedWeblogs() doesn't return most commented weblogs unless called with limit = -1 > --------------------------------------------------------------------------------------------- > > Key: ROL-1756 > URL: https://issues.apache.org/roller/browse/ROL-1756 > Project: Roller > Issue Type: Bug > Components: Database Access & Data Model > Affects Versions: 4.0 > Environment: Doesn't look environment-specific. Environment was: Roller 4.0, MySQL 5.0, unknown Java version. > Reporter: Anil Gangolli > Assignee: Roller Unassigned > Priority: Minor > > This issue was originally reported by Guglielmo Carandente > If you call getMostCommentedWeblogs() with a limit value other than -1, it may not actually return the most commented weblogs. > This getMostCommentedWeblogs() method is exposed as part of the site model and the call goes down to WeblogEntryManager.getMostCommentedWeblogEntries(). > The problem results because the query itself does not do any ordering on its result set because (according to a comment near the query definition) of a restriction in JPA QL, yet if you pass a limit value other than -1 the query result set is limited to the specified size. The ordering is then done by sorting the results in the Java code within the method WeblogEntryManager.getMostCommentedWeblogEntries(). So if you limit of the result set, it may not contain the most commented entries. You'll just end up sorting the first n entries returned by the query where n is the value of limit passed. > To work around this bug, you can pass -1 for the length limit and then limit the number of results you actually display in your velocity template. > The performance of this workaround may not be acceptable if you have a large number of blogs on the site. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.