I understand that when look up a EJB A, I can either by its ejb-reference entry in deployment descriptor or its JNDI entry.
It is my understanding that if I look up a bean from a remote client, I must use the JNDI entry; and if I do that from a remote EJB B, I can do either way provided that the deployment descriptor for B defines ejb-reference to A, and use ejb-reference is preferred over a direct JNDI look up.
If I have a delegate class that wraps up the look up logic, and this delegate can be called by either a remote client or another EJB, then, I wil l have to supply two methods, one to look up JNDI for the client to use, and another to look up ejb-reference for other EJBs to use, right? I do not like that, but is there a one-function-fits-all solution?
what is the advantage of using ejb-reference vs. a direct JNDI lookup?
My thought is that, according to EJB spec, the deployer sets JNDI entry, therefore, when we code EJB to call another EJB, we as bean developer do NOT know the JNDI yet. However, the client developer always sees the JNDI, since they get the deployment descriptor after the deployer fills in JNDI. Is my understanding correct? In other words, there really is no difference whether to use ejb-reference or a direct JNDI lookup.
Thanks.
Yan
It is my understanding that if I look up a bean from a remote client, I must use the JNDI entry; and if I do that from a remote EJB B, I can do either way provided that the deployment descriptor for B defines ejb-reference to A, and use ejb-reference is preferred over a direct JNDI look up.
If I have a delegate class that wraps up the look up logic, and this delegate can be called by either a remote client or another EJB, then, I wil l have to supply two methods, one to look up JNDI for the client to use, and another to look up ejb-reference for other EJBs to use, right? I do not like that, but is there a one-function-fits-all solution?
what is the advantage of using ejb-reference vs. a direct JNDI lookup?
My thought is that, according to EJB spec, the deployer sets JNDI entry, therefore, when we code EJB to call another EJB, we as bean developer do NOT know the JNDI yet. However, the client developer always sees the JNDI, since they get the deployment descriptor after the deployer fills in JNDI. Is my understanding correct? In other words, there really is no difference whether to use ejb-reference or a direct JNDI lookup.
Thanks.
Yan