Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Cache EJB3 Entites

  Asked By: Ruben    Date: Jan 17    Category: Java    Views: 962
  

We use ejb3 in the persistance layer of our application and it s container is jboss, in this situation we want to cache some entites, whould you please help me to find a solution to cache?

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Qadriyyah Malik     Answered On: Jan 17

EntityManager is the one that provides caching mechanism through attached entity instances. As long as you have a persistence context - which is a set of managed entity instances - the instances will be accessible through entitymanager interface. in another word, as long as entity instances are attaced, they are accessible. you can access them by using their primary key as the id of the cach (which is in map nature)

JBoss uses JBoss cache  beneath to manage caching, here is something you might want to look at:

docs.jboss.org/.../clusteredentity.html

a hint though:

to end up with a better performance, it is good practice to

i) avoid caching for entities that you frequienty "update" - because if you keep updating entities and IF your system is clustered based, it takes time to update all remote caches in clusters and introduces network traffic overload. please note that this might not be an issue for non-clustered systems (single server).
ii) avoid caching for entities that you are NOT frequently accessed because entities that are not access regularly and are pretty huge in size might allocate too much memory that actually should have been used for entities that ARE access more frequently
iii) try to use cache for only entities that you frequently "access" and consider good amount of memory for them - well because this is what caching is about,

 
Didn't find what you were looking for? Find more on Cache EJB3 Entites Or get search suggestion and latest updates.




Tagged: