File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes Urgent:Please Help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Urgent:Please Help" Watch "Urgent:Please Help" New topic

Urgent:Please Help


Joined: Jun 19, 2002
Posts: 1
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
Karl Laird
Ranch Hand

Joined: Jul 14, 2001
Posts: 67
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="" target="_blank" rel="nofollow"></a>
I agree. Here's the link:
subject: Urgent:Please Help
It's not a secret anymore!