Steve Muench wrote:
> if I have 10,000 sales people likely their leads and closed sales
> are likely not modeled as part of the Salesperson EB itself, but
> instead as a related Lead and Sale EB.
You could also set up a two-way CMR relationship here for sales and the
person responsible. Thus, it doesn't really matter whether you ask the
sale for the salesman responsible, or the salesman for his sales. If the
salesman has access to his sales, then it can just as easily have a
convenience method on the interface to give a "total sales figure". That
takes care of the aggregation part.
For the ordering part, I would take a different approach. If you DB has
to sort 10,000 objects and then just pick the top 5, that's a hugely
inefficient operation. Instead, I would create some form of bar first -
pick all sales totals over some value (user defined with an input
parameter) and then sort on that. For example, have the finder locate
the min and max sales totals and calculate the top five percent of sales
totals. Use that as the return value of the EB finder and then sort the
bean references as per usual in a List. I'd come up with some useful
code, but my brain is too fried now (can't even get my CVS commit
messages right when I have them written down in front of me!). Will do
it in the morning.
--
Justin Couch http://www.vlc.com.au/~justin/
Freelance Java Consultant http://www.yumetech.com/
Author, Java 3D FAQ Maintainer http://www.j3d.org/
-------------------------------------------------------------------
"Humanism is dead. Animals think, feel; so do machines now.
Neither man nor woman is the measure of all things. Every organism
processes data according to its domain, its environment; you, with
all your brains, would be useless in a mouse's universe..."
- Greg Bear, Slant
-------------------------------------------------------------------
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".