Adena,

Suppose you wanted to update the salaries of all the employees in a given
department. You could do this two ways. The first is to use a finder method on
employee which returns all the employees in the department. Then iterate through
this list updating their salaries. Alternatively, you could use a session bean
to get the list of employees primary keys. Then iterate through this list
calling Employee.findByPrimaryKey and updating each salary.

I think with most EJB servers the first option is more efficient.

--Victor Langelo


Adena Galinsky wrote:

> Hi everyone,
> Everything I've been reading seems to indicate that calling the find methods
> in entity beans just wastes time and resources.  They seem to recommend
> writing find methods in session beans, which issue JDBC calls directly and
> return an array of primary keys.  Given that this is faster and lighter
> weight, why would we ever write a find method in an entity bean which
> returns more than one instance of a bean?
> -Adena
>

===========================================================================
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".

Reply via email to