aspose file tools*
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes Question regarding Business Delegate, Stateless Session Bean and Entity Bean in SCEA Part 2 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 "Question regarding Business Delegate, Stateless Session Bean and Entity Bean in SCEA Part 2" Watch "Question regarding Business Delegate, Stateless Session Bean and Entity Bean in SCEA Part 2" New topic
Author

Question regarding Business Delegate, Stateless Session Bean and Entity Bean in SCEA Part 2

Madhu Maniganta
Greenhorn

Joined: Nov 27, 2010
Posts: 14
Hi All Ranchers,
Thanks all for your support, I am working on part 2 and have a question about Dependency Injection in Business Delegate layer in a n Tier architecture.
(A) Is having jsp--->Managed Bean--->Business Delegate--->Service Locator--->Stateless Session Bean(Dependency Injection)---->Entity JPA acceptable in class and sequence diagrams?
OR
(B) should I show a Business Delegate with Dependency Injection also like Stateless Session Bean injects for EntityManager? which means
jsp--->Managed Bean--->Business Delegate (Dependency Injection)--->Stateless Session Bean(Dependency Injection)---->Entity JPA in my diagrams?

which among (A) and (B) is correct?
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30516
    
150

If you were implementing this code, would you be writing a service locator? If so, A is correct. If not, B is correct.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Madhu Maniganta
Greenhorn

Joined: Nov 27, 2010
Posts: 14
Thanks so much for the response. If I go with (B), can a Business Delegate be used just to separate Presentation layer and Business Layer. Because I read on the sun website (link below) that Business Delegate hides lookup and access details of EJB architecture, does it mean that Business Delegate and Service Locator must go together? or can I just use it as a Presentation and Business layer separator?

http://java.sun.com/blueprints/corej2eepatterns/Patterns/BusinessDelegate.html
Dmitri Ericsson
Ranch Hand

Joined: Feb 16, 2010
Posts: 109
I've used much simplier and straightforward solution (and passed):
JSF->Stateless Bean (dependency injcection)->JPA
The lookup is done by the server in dependency incjection, so I think there is no need for locators or business delegaetes.


SCEA 5, SCJP 6 My SCEA Experience
Rajiv Shr
Ranch Hand

Joined: Aug 11, 2010
Posts: 37
You dont need to use Service Locator if you are using Dependency Injection. Both do the same thing ie hiding the complexity of the lookup, and they both do it differently. You should use one or the other, not both. Read this article - http://martinfowler.com/articles/injection.html#ServiceLocatorVsDependencyInjection

For your follow-up question, yes, you can use Business Delegate as a separation between the presentation and business layer. There are different opinions on where to show the business delegate component in the Component diagram in part 2. I showed it in the presentation layer.

- Rajiv
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Question regarding Business Delegate, Stateless Session Bean and Entity Bean in SCEA Part 2