Criteria crit = new Criteria().addAsColumn("count", "count(*)");

should do it.

or you can use BasePeer.executeQuery(..) directly.

fedor.

> -----Original Message-----
> From: burtonator [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, August 08, 2001 2:53 PM
> To: Turbine Mailing List
> Subject: Ability to do a "select count(*)" in BasePeer?
> 
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> 
> Hey.
> 
> Is there an elegant way to do a:
> 
> select count(*) as 'count' from table;
> 
> The reason for a count() is that this is done within the DB 
> so it is a somewhat
> lightweight operation.  Retrieving all the rows from the 
> database as a Vector and
> then using size() on the Vector would be a very expensive 
> operation vs "select
> count"
> 
> ....
> 
> Any suggestions.  Does this depend on the new query model?
> 
> Kevin
> 
> - -- 
> Kevin A. Burton ( [EMAIL PROTECTED], [EMAIL PROTECTED], 
> [EMAIL PROTECTED] )
>         Cell: 408-910-6145 URL: http://relativity.yi.org ICQ: 
> 73488596 
> 
> Captain, the salvaged node has not maintained synaptic 
> cohesion within the
> cortical transplant!
> 
> 
> 
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.0.4 (GNU/Linux)
> Comment: Get my public key at: http://relativity.yi.org/pgpkey.txt
> 
> iD8DBQE7cbSyAwM6xb2dfE0RAiBOAJ4o2CEWiNZVrZm725bSx8qcQBRtaACgw92T
> 2Ao/cgzR6SwCnJS9AW/KmZs=
> =7YT1
> -----END PGP SIGNATURE-----
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to