• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Scott Selikoff
Bartenders:
  • Piet Souris
  • Jj Roberts
  • fred rosenberger

Where should Business Delegate be ?

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I'm new to java and currently going through the various design patterns after conquering J2EE basics. I'm currently refering to J2EE Design Pattern by Crawford & Kaplan - O'Reilly.

According to them, when using Business Delegate Pattern, the business delegate should reside on the business tier only.

Now does that imply that it should be in the same package as the EJB and other POJOs?

Also some web sites and at-least two implementations I've seen say that the business delegate must reside on the web tier ie in the package at the web tier? I feel this is more logical also !

So which one is better or correct?

Finally if the business delegate resides on the business tier, then it doesn't need to lookup the EJB I guess (being in the same package)?

So how will the client code lookup this business delegate? Then it probably also won't require the ServiceLocator Class also?

Please help as I'm terribly confused.
 
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One of the main asset of the Business Delegate design pattern is to : "hide the underlying implementation details of the business service, such as lookup and access details of the EJB architecture." (Sun's Core J2EE Patterns - Business Delegate)
In other word eveytime you need to do a lookup to an EJB you might consider using a business delegate.
In which tier are you doing lookups to EJBs? Well in both the web and the business tiers.
For instance in the web tier you may have to access some EJB session beans using the Session Facade design pattern.
In the business tier the EJB session bean may have to access some EJB entity beans.
In both cases you need to use some lookup mechanism so the Business Delegate design pattern could be used in both tiers.
Since this pattern hides the "remoteness" of accessing EJBs it might be less advisable to use it in the web tier
without using a coarse grained access strategy to the EJBs (like the Session Facade design pattern).

Due to the distributed nature of EJBs you still need to use a lookup mechanism in the business tier because the deployment of the EJBs might be located on many JVMs / machines
so the Business Delegate design pattern can still be useful in the business tier.

Regards
 
reply
    Bookmark Topic Watch Topic
  • New Topic