Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 60063 invoked from network); 15 Dec 2008 18:08:23 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 15 Dec 2008 18:08:23 -0000 Received: (qmail 85242 invoked by uid 500); 15 Dec 2008 18:08:35 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 84567 invoked by uid 500); 15 Dec 2008 18:08:34 -0000 Mailing-List: contact user-java-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user-java@ibatis.apache.org Delivered-To: mailing list user-java@ibatis.apache.org Received: (qmail 84558 invoked by uid 99); 15 Dec 2008 18:08:34 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 15 Dec 2008 10:08:34 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of jeffgbutler@gmail.com designates 64.233.170.188 as permitted sender) Received: from [64.233.170.188] (HELO rn-out-0910.google.com) (64.233.170.188) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 15 Dec 2008 18:08:19 +0000 Received: by rn-out-0910.google.com with SMTP id j66so2244833rne.9 for ; Mon, 15 Dec 2008 10:07:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=eL8OrxKdTQiUet4j63XTBv9qATZKHJNJfNQp86CaX4U=; b=xkB8YWt5Vxy/3T4EpSTGIfpOYkQaRTiobpLb7Zy7Eu4kAHWyN/iEa/FIQHFzIyjigX JR8TPVxgZxP3dW04voti+mvGoyYkWIL4dESPUNk4fBTQ9d/Z15xa3RUyifxHwmWrV+L0 5qWYEil+f7lxFnNxc0VwaUrYmLZV09KDcGrWk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=ZkKOy8pvCP19E8OKWis0FXIORthGAyTwRMIJNc+CzU6ing3JXqDmLe23c8zede3j3t LMvyfjY1Y0p6v6i4RhAqgPa+JXDM1BsHenrXSKT9J08z8I9L7Vz1KJ8oC/+Dk3P/eGAs nCPOq2lohz/Pz+ryHYxRZdKDQFxbHMuAPYpwk= Received: by 10.150.135.2 with SMTP id i2mr13015549ybd.229.1229364478450; Mon, 15 Dec 2008 10:07:58 -0800 (PST) Received: by 10.151.40.4 with HTTP; Mon, 15 Dec 2008 10:07:58 -0800 (PST) Message-ID: Date: Mon, 15 Dec 2008 12:07:58 -0600 From: "Jeff Butler" To: user-java@ibatis.apache.org Subject: Re: Wrong sorting when using orderBy clause In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: X-Virus-Checked: Checked by ClamAV on apache.org If you turn on logging, then you can verify exactly what's coming back from the DB. My guess is that something's not quite right in your Service class. groupBy works best when there is a very simple getter/setter for the list. For example, in your Service class you should have something like this: public class Service { private List tagList; // other properties public List getTagList() { return tagList; } public void setTagList(List tagList) { this.tagList = tagList; } } You don't need any more logic with the tagList property. Most of the issues we see with groupBy are related to users trying to do something more complex with the List properties. Jeff Butler On Mon, Dec 15, 2008 at 11:55 AM, Corrado Alesso wrote: > Thanks for your reply. > > Yes, the query has an 'order by' on just those two columns. > > ORDER BY t1.id ASC, t2.tag ASC > > > I can provide some more information to track down the problem... > > The query has a LIKE clause defined as > > WHERE LOWER(tag) LIKE LOWER('%$value$%') > > > With pgAdmin I always get the correct results, no matter what I pass to the > LIKE clause. > Instead, when I refresh my page that fetches the data with iBatis, I get > different results if I pass "grap", "graph", or "graphic" (I mean, different > ordering in the 'tagList' property). > > > Between the DB and iBatis there is Spring and the JDBC driver > (postgresql-8.3-603.jdbc4.jar). > > I can provide a test program that reproduce this behaviour. > > If iBatis use, as expected, the order returned by the DB, maybe there's an > issue in the driver? > > Please help me track down this problem :( > > > Thank you, > Corrado > > > In data 15 dicembre 2008 alle ore 18:21:47, Jeff Butler > ha scritto: > >> No - I have tests running that show this is not an issue. >> >> iBATIS will use the order returned from the database. Make sure your >> SQL has an order by clause containing both id and tag. >> >> Jeff Butler >> >> >> On Mon, Dec 15, 2008 at 11:03 AM, Corrado Alesso >> wrote: >>> >>> In data 14 dicembre 2008 alle ore 15:33:40, Corrado Alesso >>> ha scritto: >>> >>>> Hello everyone, I'm facing a problem with iBatis. >>> >>> [cut] >>> >>> Do you think that this should be filed as an iBatis issue? >>> > > >