Friday, March 13, 2009

Is there any default cache management system with Entity beans ? In

Question :Is there any default cache management system with Entity beans ? In
other words whether a cache of the data in database will be maintained in
EJB ? (EJB)

Answer :Caching data from a database inside the Application Server are what
Entity EJB's are used for.The ejbLoad() and ejbStore() methods are used
to synchronize the Entity Bean state with the persistent storage(database).
Transactions also play an important role in this scenario. If data is
removed from the database, via an external application - your Entity Bean
can still be "alive" the EJB container. When the transaction commits,
ejbStore() is called and the row will not be found, and the transcation
rolled back.

No comments: