Return-Path: Delivered-To: apmail-db-ojb-dev-archive@www.apache.org Received: (qmail 4817 invoked from network); 25 Jan 2004 09:52:36 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 25 Jan 2004 09:52:36 -0000 Received: (qmail 37222 invoked by uid 500); 25 Jan 2004 09:52:11 -0000 Delivered-To: apmail-db-ojb-dev-archive@db.apache.org Received: (qmail 36989 invoked by uid 500); 25 Jan 2004 09:52:09 -0000 Mailing-List: contact ojb-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "OJB Developers List" Reply-To: "OJB Developers List" Delivered-To: mailing list ojb-dev@db.apache.org Received: (qmail 36953 invoked from network); 25 Jan 2004 09:52:09 -0000 Received: from unknown (HELO mail.gmx.net) (213.165.64.20) by daedalus.apache.org with SMTP; 25 Jan 2004 09:52:09 -0000 Received: (qmail 17419 invoked by uid 65534); 25 Jan 2004 09:52:20 -0000 Received: from adsl-62-167-116-3.adslplus.ch (EHLO gmx.ch) (62.167.116.3) by mail.gmx.net (mp005) with SMTP; 25 Jan 2004 10:52:20 +0100 X-Authenticated: #15507884 Message-ID: <401391C8.5000708@gmx.ch> Date: Sun, 25 Jan 2004 10:52:08 +0100 From: Jakob Braeuchi User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040113 X-Accept-Language: en-us, en MIME-Version: 1.0 To: OJB Developers List Subject: Re: PersistenceBroker.getCount() -- Doesn't work for MSSQL Uniqueidentifiers!!! References: <316E5B943771D311BAC500805FD7A078025F3629@MAIL.osn.state.oh.us> <40128B7C.3010704@gmx.ch> In-Reply-To: <40128B7C.3010704@gmx.ch> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N hi andrew, if the query is not distinct i can use count(*) for single and multiple keys: select count(*) from person_project; if it's distinct i'll have to use concatenation: select count (distinct(person_id || project_id)) from person_project; this syntax works with hsqldb and sapdb but fails with mysql :( jakob Jakob Braeuchi wrote: > hi andrew, > > according to some newsgroups there's no performance penalty for using > count(*) instead of count(pk). so we could use count(*) for queries not > using DISTINCT. > > i'll have a look at it asap. > > hth > jakob > > Clute, Andrew wrote: > >> The getCount function does a 'select count()' where it inserts the >> primary keys for your return class into the count clause. >> >> That is great, until you are using, like we are, a field of type >> 'uniqueidentifier' that is available in SQL 7 and up. MSSQL Server does >> not support that using of uniqueidentifier's as the clause for a count. >> You will get the following error: >> >> 'The count aggregate operation cannot take a uniqueidentifier data type >> as an argument.' >> >> So, this leaves me in a bad position -- by using that as my primary key, >> I can no longer access length's of my result set (and secondary be able >> to do paging). >> >> I don't see any workaround in the current code, and am wondering if >> there is an appropriate fix for this problem for the codebase? >> >> Is there a reason why we couldn't have the ability to do 'select >> count(*)' as a fallback? >> >> I will admit, I don't know the intricate details about SQL92 -- so I >> don't know what the benefit of naming a column in a count clause versus >> the '*'. >> >> I guess my other solution is to extend PersistenceBroker and make my own >> implementation for that, and not use the pk's in the count clause (what >> would the side effects be of that)? >> >> Thanks >> >> -Andrew >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org >> For additional commands, e-mail: ojb-dev-help@db.apache.org >> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org > For additional commands, e-mail: ojb-dev-help@db.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org For additional commands, e-mail: ojb-dev-help@db.apache.org