• Post Reply Bookmark Topic Watch Topic
  • New Topic

Caching Objects in EJB 2

 
Jack Numen
Ranch Hand
Posts: 42
Hibernate Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do we cache objects in EJB 2.

My requirement is i need to get data from the database for the first time and retain in cache it throughout the application life.

Regards,
Jacen
 
Michael Remijan
Author
Ranch Hand
Posts: 131
7
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One option is to have a singleton session bean. It can be created automatically when the application starts and it's lifecycle methods can be used to get and cache whatever you need. This will be retained throughout the application life. If you need more advanced caching solutions, you'll want to look at the JSR for jcache.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!