Entity bean caching is definitely VERY vendory specific, hence you will need
to ask vendor-specific questions to get satisfactory answers.

I believe Weblogic is quite fond of caching Primary Keys...  hence
findByPrimaryKey is very optimized.  If you pair this up with CMP, you will
reduce db calls to just one.  However, there are tricks you CAN do in BMP to
simulate the type of caching you have in CMP...

Gene

-----Original Message-----
From: A mailing list for Enterprise JavaBeans development
[mailto:[EMAIL PROTECTED]]On Behalf Of Peter Delahunty
Sent: Sunday, August 27, 2000 8:58 AM
To: [EMAIL PROTECTED]
Subject: How does Entity bean caching work


The way i see it with entity beans you are always going to the database at
least once each time you need and EB. This is presuming i never keep a
reference to the EB remote interface and i always call findByPrimaryKey
For example:

Suppose i had a servlet making calls to an EB.

1. The first time the servlet is run i call findByPrimaryKey on the home
interface of my EB.
2. this then calls ejbFindByPrimaryKey which makes a call to the database to
validate the PK
3. if it is there i get the remote interface returned and EB instance is
created and cached.

however

4. the next time the servlet runs i call findByPrimaryKey again on the home
interface of my EB
5. this then means another call to ejbFindByPrimaryKey and so a call to the
database to validate the PK
6. i get the remote interface returned, and the eb that was cached is used
to handle calls.


Is this right ? or on the second call to findByPrimaryKey does the container
realise that the EB is cached an so does not call the ejbFindByPrimaryKey
method which means not calling the db a second time.

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

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