db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Clute, Andrew" <Andrew.Cl...@osn.state.oh.us>
Subject PersistenceBroker.getCount() -- Doesn't work for MSSQL Uniqueidentifiers!!!
Date Wed, 21 Jan 2004 21:49:47 GMT
The getCount function does a 'select count(<pk>)' 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


Mime
View raw message