Return-Path: Mailing-List: contact turbine-torque-user-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list turbine-torque-user@jakarta.apache.org Received: (qmail 63685 invoked from network); 3 Feb 2003 10:18:29 -0000 Received: from mta07ps.bigpond.com (144.135.25.132) by daedalus.apache.org with SMTP; 3 Feb 2003 10:18:29 -0000 Received: from [192.168.0.2] ([144.135.25.84]) by mta07ps.bigpond.com (Netscape Messaging Server 4.15 mta07ps Jul 16 2002 22:47:55) with SMTP id H9Q9Z300.0DC for ; Mon, 3 Feb 2003 20:18:39 +1000 Received: from CPE-144-137-73-195.nsw.bigpond.net.au ([144.137.73.195]) by psmam06.mailsvc.email.bigpond.com(MailRouter V3.0n 116/1249736); 03 Feb 2003 21:18:39 User-Agent: Microsoft-Entourage/10.1.1.2418 Date: Mon, 03 Feb 2003 21:18:40 +1100 Subject: Re: Count(*) and criteria From: Scott Eade To: Turbine Torque Users List Message-ID: In-Reply-To: <200302031053.27263.rick@subnet.at> Mime-version: 1.0 Content-type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N On 3/02/2003 8:53 PM, "peter riegersperger" wrote: > > Criteria crit = new Criteria(); > [add some conditional expressions with criteria.add(...)] > Criteria myCrit = (Criteria)crit.clone(); It seems that Criteria does not implement Cloneable or clone() so I guess it would be necessary to create a second criteria from the beginning and set it up to be the same as the original (yuck). > List myList = MyPeer.doSelect(crit); > > myCrit.addSelectColumn("SELECT Count(ID)"); This would have been: myCrit.addSelectColumn("count(ID)"); But it won't work anyway because the crit cannot be cloned. > List myCountList = MyPeer.doSelect(crit); > [...] >> LargeSelect may obviate the need to do the count(*) as it provides an >> indication of the length of the result set as the query progresses, e.g. it >> might say that it is displaying page 1 of > 25 indicating that there are >> more than 25 pages of data available. > > i looked at the javadoc, and it sounds like what i need. > in the doc, it is stated that LargeSelect should be stored in the session. How > big is the performance impact of re-creating it each time (and then hopping > to the requested page)? The whole point is that you are not recreating it each time - it is there in the session with the chunk of data that the user is paging through. One thing I do with LargeSelect is attempt to ensure that the object is removed from the session as soon as the user goes down a different path in the application. > personally, i hate putting anything in the session and i try to avoid it as > much as i can. It is good to be cautious about putting things in the session, but it exists for a reason and is put to good use by LargeSelect. I use it and it works well (I am biased because I contributed heavily to it). > > many thanks for your help, > > rick Cheers, Scott -- Scott Eade Backstage Technologies Pty. Ltd. http://www.backstagetech.com.au .Mac Chat/AIM: seade at mac dot com