Sergei,
 
I ran into this problem once before...sorry about the performance, I didn't know how big your beans were.
 
What I did was create an entity bean which was just the list of pk's for the other bean...I mean that's all. Then call the list, findByPK(1), and return the list of pk's from directly in the enitity bean. Although you had one more bean, it was only one more, not n more. This will fly. Each time you create a new entity bean (the big bean), do a business method for the lite bean, addOtherPK(xxx). Then when you need the list of pk's, or the number, have a business method, getMyPKS(), and this will return a collection of only strings or integers or bigs or whatever.
 
I used this stratagy with a chemical component list. It was important to list the molecular weight, name and boiling point on the web, but on the enterprise tier, we needed to know individual properties for each component (critical properties, vapor pressure curves, you name it). Using a find on the heavy bean was TAXING our server. We created another bean, whose only purpose was to keep the mw, name and bp as a LIST.
 
This really speeded things up.
 
Hope this helps.
 
Regards,
 
the elephantwalker
 
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Sergei Batiuk
Sent: Wednesday, June 14, 2000 7:08 AM
To: Orion-Interest
Subject: Re: Counting CMP entities

Dear elephatwalker,
 
It looks like a big perfomance hit for both database and container to count entities in such a way. Another decision is to talk directly to db, which is also not good.
 
Browsing EJB 2.0 documentation, I found out that there is an ejbSelect() method that allows to perform queries that return results of arbitrary types. However, I could not find any good examples showing how to use it.
 
WBR,
Sergei
----- Original Message -----
Sent: Thursday, June 14, 2001 1:56 AM
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]]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