I am trying to call a EJB from another EJB. I did this by JNDI lookup & then doing the usual stuff for calling the EJB. So Is there any better way of doing this. Because, wound'nt this be a overhead.. i mean maknig a lookup.
If both your EJB's are on the same application server, they can use EJBLocalObject and EJBLocalHome Interfaces to better the perfomance during look. Or may be a cached service locator can help. An approach like Spring can help better through DI (IOC). I will not want to talk on the Spring Approach as it would be out-of-scope.
SCDJWS, SCBCD, SCJP
posted 9 years ago
You could implement two J2EE design patterns in this case.  Session Facade &  Service Locator. You can maintain a Session Bean as Session Fa�ade on the EJB container. So the client side business delegator would always interact with this Session Facade by looking up for the Session Bean (Session Fa�ade) by using Service Locator. In this case, this call would be the remote call and for that you would be using EJBObject and EJBHome. This session facade would be the entry point to access other EJB's. Other EJB calls would be local calls for the session fa�ade and for that you would be using EJBLocalObject and EJBLocalHome and this practice would increase the performance of your app. This is applicable if all the EJB�s are deployed on same application server.
------- SCJP 1.4, SCWCD 1.4, SCBCD 1.3, (SCEA Part I preparing......)
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads