This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
Hi all, if i understeand it good, the service locator caches the EJBHome-Obejct. I was wondering, why not cache the EJB-Object, instead of the EJBHome-Object? Greetings, Roul
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Maulin Vasavada
Ranch Hand
Joined: Nov 04, 2001
Posts: 1865
posted
0
Hi Roul, EJB Object refers to the Bean object on the server side so its pooled or cached by the server already to enhance performance. Why to cache it again on client side where we are using service locator? Also, if we cache EJBObject then server's pooling etc would be meaningless and it would like client is managing EJBObject which is against the J2EE architecture right? I hope I make sense.. Others please provide more insights here... Regards Maulin
Caching EJB objects doesn't help you very much. Usually you have to use several objects of the same type and instead of caching let's say 10 EmployeeBean bean objects,you cache only the EmployeeHome object and through this you can create/find/delete any number of EJBObjects. The EJBHome object is used as a factory for EJBObjects and by caching it you don't have to look it up every time you want to manipulate an object it is responsable of. You could read the EJBHomeFactory pattern (you can find it in Floyd Marinescu's EJB Desing Patterns) and after that you'll see the benefits of caching the EJBHome objects.