This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes Entity Bean Cache Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Entity Bean Cache" Watch "Entity Bean Cache" New topic

Entity Bean Cache

kri shan
Ranch Hand

Joined: Apr 08, 2004
Posts: 1396
What is 'Entity Bean Cache'?
Valentin Tanase
Ranch Hand

Joined: Feb 17, 2005
Posts: 704
Spec says that the container must maintain a pool of entity bean instances. However the containers chose to cache the entity beans as well, in order to improve server�s performances.

I think, therefore I exist -- Rene Descartes
James Du
Ranch Hand

Joined: Mar 23, 2001
Posts: 186
However the containers chose to cache the entity beans as well

Hi, Valentin

I am wondering what do you mean by chose to cache.... Since the pool is must, what do you think the container could use it otherway ?

Valentin Tanase
Ranch Hand

Joined: Feb 17, 2005
Posts: 704
Hi James,

The answer to your question is not very short, but I�ll do my best to make it short. A straight answer would be this: because the container implements a lot of feature that are beyond the J2EE specs: caching entity beans between transactions (and reducing the number of ejbLoad()/ejbStore() method calls), providing read-only EJBs, etc. Therefore the container will chose to implement a cache of entity beans as well. Please don�t understand me wrong: the container will not replace the free pool with an internal cache; this techniques are complementary not exclusive. However there is a big difference between the pool and the internal cache. The cache will contain only READY instances: they have identity (an associated primary key), but are not currently enlisted in a transaction. WebLogic maintains READY entity EJB instances in least-recently-used (LRU) order. If the bean gets enlisted in a transaction then the instance becomes ACTIVE and will return to cache after the transaction ends. As you can see there is a lot of stuff beyond the specs�
I agree. Here's the link:
subject: Entity Bean Cache
It's not a secret anymore!