• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Business Delegate and dependency Injection

 
Eduardo Plata
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all...
I�ve seen some previous post about the use of dependency injection in managed beans (jsf, servlets) to get reference to a Session Facade Bean.

After reading all, I think that the consensus when using JEE5, you should use "Dependency Injection". But then, I have a doubt, I understand that the reference to the EJB (using DI) is not really the EJB, but a component provided by the container that makes the same work (Business Delegate and Service Locator pattern). Now, if I don't use a BD built by myself, where should I manage my Network, Remote exceptions? Is it a good practice to make it on my managed bean? Does this question goes to just have a better exception management?

Greetins,

Ra�l
 
Paul Michael
Ranch Hand
Posts: 697
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
AFAIK, DI will only work for "local" EJBs so it might not be the best solution for obtaining reference to EJBs from your Web tier.

But, DI will be useful for setting the EntityManager and other resources managed by the container to your EJBs.

HTH.
 
Lann Lu
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
DI applies to both Local and remote business interface/reference.

DI is invoked during init phase, before any business methods, if exception occurs, EJB instance is destroyed.

Under EJB 3 context, the most likely system exception you will get is "EJBException" (not remote exception)

Cheers,
Tao
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic