Okay, let's take this step by step. Tell me when I go off track.
With Bean-Managed Persistence:
A client calls the personHome.findByName("bob") in the
server-generated implementation of the PersonHome interface.
The server duly calls personBean.ejbFindByName("bob").
Using a single SQL SELECT statement that looks like:
SELECT id FROM person WHERE name like "bob%"
the 20 people called "bob" are found, so this returns an Enumeration
containing the primary keys for those twenty entities.
[[I'm guessing here]] The server then calls
personBean.ejbFindByPrimaryKey(keyI) 20 times to build an enumeration
of those twenty people. Each call may involve a single SQL SELECT
statement, but it will be executed twenty times:
SELECT name, address, phone FROM person
WHERE id = ?
Eventually, the server returns to the client an Enumeration containing
20 instances of the server-generated implementation of the Person
interface.
Is that what typically happens? In that case, that's pretty
inefficient, because the second SQL SELECT statement was executed 20
times.
as far as my knowledge goes with respect to cantainer managed beans when you write a sql in the finder method the sql would
return you a resultset, you would have to extract the primary key from the resultset create a primary key instace & return it as an enumeration. there is no need to run the findByPrimaryKey() n number of times..
With Container-Managed Persistence, a decent O/R tool should be able
to do it all in one SQL statement that looks like:
SELECT id, name, address, phone FROM person
WHERE name LIKE "bob%"
i think in the case of container managed entity beans also the same result is achieved without a like clause. I checked the java
files generated by the container(weblogic 4.5.1) there again it does not use the like clause
please correct me if i am wrong...
Much more efficient.
- Rujith.
===========================================================================
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".
