This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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: 64
...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.


follow me at 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 !!

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: DI or BD using EJB 3
 
Similar Threads
"Business Delegate-Session Facade" and "Command Pattern- Session Facade" pattern
Passing Serilizable JPA Entity from EJB to Web Tier
Passed SCEA with 98%
SCEA Part II - Design Question
Club Business Delegate with Command Pattern, pros-cons