aspose file tools *
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes DI or BD using EJB 3 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "DI or BD using EJB 3" Watch "DI or BD using EJB 3" New topic
Author

DI or BD using EJB 3

Krishna Jonnalagadda
Ranch Hand

Joined: Feb 09, 2010
Posts: 43
Dependency Injection (DI) or Business Delegate (BD) when using EJB 3:

I am new to EJB 3 but have used EJB 2 almost 5 yrs back and am familier with Business Delegate -->Service Locator -->Session Facade -->DTO-->DAO way of accessing entities.

But EJB 3 supports POJO which eleminates the need for DTO and also supports DI which eleminates the need for BD. I didnt get a chance to use EJB 3 yet. So actually i am confused in choosing b/w these two. I think we can still have a BD to get access to a session facade (which is remote) from the presentation layer (which will be on a different machine on a different jvm). Have the DI for accessing local ejb's (with in same jvm). Any thoughts ?

Also how do i depict the DI in a class diagram, i know how to do that for a BD as we have pattern for that. Any references/example to depict DI in a class diagram will be greatly appreciated.

Thanks
Sharma Ashutosh
Bartender

Joined: Apr 06, 2001
Posts: 346
You can use DI which will inject Service Facade(EJB 3 Session Beans) into your presentation tier. You can refer to Mark Cade's book and show the DI and other common infrastructure/utilities/helper classes in a separate package(the way it is done in the book). That is sufficient.


Ashutosh Sharma
SCJP 1.2, SCEA 5, Brainbench certified J2EE Developer, Documentum Certified Professional
Blog : http://scea5-passingpart2and3.blogspot.com/
Yegor Bugayenko
Ranch Hand

Joined: Feb 11, 2011
Posts: 78
...DI which eleminates the need for BD...


How dependency injection eliminates the need for business delegate? As I understand they serve different purposes. Dependency injection eliminates the need for Service Locator, sometimes. Business Delegate's purpose is to decouple presentation from business logic. No matter whether it's EJB or not.

Anyway, in my assignment I've been used EJB3 and business delegate.


SCEA, PMP, read my blog: www.yegor256.com
Sharma Ashutosh
Bartender

Joined: Apr 06, 2001
Posts: 346
More over you can also take care of handling exceptions also in your Business Delegate layer.
Krishna Jonnalagadda
Ranch Hand

Joined: Feb 09, 2010
Posts: 43
Sharma and Yegor,

Thanks for your replies !!

I think i got confusion cleared ...DI eliminates the need for SL. BD for decoupling presentation from business logic.

I'll follow Cades example for representing DI..

Thanks a lot !!

 
 
subject: DI or BD using EJB 3