Reputation: 1497
I've implemented EJB 2.0 session beans as POJOs behind an EJB facade.
I wish to get a reference to Bean B from Bean A. Should I:
a. Use ejb-ref and perform a JNDI lookup
b. Instantiate an instance of B directly(since it's a POJO)
Both would give me the same result. What are the pros and cons of each method? Why should I choose one over the other?
Thanks.
Upvotes: 0
Views: 470
Reputation: 3172
You never instantiate managed objects yourself. You should perform a lookup. EJB 2.0 are far from POJOs. EJB 3.x are POJOs but again you would never instantiate them yourself because of many reasons.
Upvotes: 1