It's not necessarily true that findAll().size() would be expensive.  A
slick container implementation would delay the actual query until the
first method call on the Collection.  If size() is the first method
called, the container could easily perform the proper select count(*).
 
The question then becomes, how slick is Orion's implementation of CMP
finders?
 
I just ran a test and discovered that Orion doesn't do this.  Oh well.
Maybe it should be logged in bugzilla as an enhancement.
 
Jeff
 

-----Original Message-----
From: Russ White [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 14, 2001 6:00 AM
To: Orion-Interest
Subject: Re: Counting CMP entities


That would work fine but would be very expensive.
 
I would create a getCount() method and have that method do a simple JDBC
call and return the count. This way the container does not have the
added overhead of creating/marshalling the collection.
 

----- Original Message ----- 
From: elephantwalker <mailto:[EMAIL PROTECTED]>  
To: Orion-Interest <mailto:[EMAIL PROTECTED]>  
Sent: Wednesday, June 13, 2001 6:56 PM
Subject: RE: Counting CMP entities

Sergei,
 
Do a findAll() ,you get a collection. Then do a result.size(), that
should do it.
 
Regards,
 
the elephantwalker
 

-----Original Message-----
From: [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>
[mailto:[EMAIL PROTECTED]]On Behalf Of Sergei Batiuk
Sent: Tuesday, June 13, 2000 3:25 PM
To: Orion-Interest
Subject: Counting CMP entities


Is it possible to count the number of records in a table with a CMP?
 
WBR,
Sergei


Reply via email to