I am a new bee in ejb please tell me that if an application uses Session beans that performs database operations, then the data that’s is read by the session beans are cached for the lifetime of the application or for a single session or for a single method call or single transaction . Thanks in advance Manav
posted 13 years ago
It really depends on whether they are stateless or stateful session beans. For a stateless session bean it would (usually) be cached for the method call. For a stateful session bean it would usually be cached for the life of the session bean (which is controlled by the bean lifecycles which is another topic in itself :-) However DB access is often best performed through the use of session beans calling entity beans - which have entirely different caching entirely. Part of the problem with relying on session bean caching is the caching is also dependent on how you are writing your db calls - there would be no caching at all if the method called itself preforms the db access - but doing otherwise can overly complicate transaction control and avoiding dirty reads.
The Eagle sneers at the Peacock<p>Systems Administrator<br />OrderWare Solutions Ltd<br /><a href="http://www.orderware.net" target="_blank" rel="nofollow">http://www.orderware.net</a>