Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Business Delegate and Session Facade usage.

  1. #1
    Junior Member
    Join Date
    Jun 2012
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Business Delegate and Session Facade usage.

    Hi guys.

    I am new to JavaEE and I recently learnt the Business Delegate and Session Facade design patterns. The tutorials from Oracle did gave me a basic idea of what they are and why they are used, but the example didn't really answer all my questions. So I decided to use a real life scenario here and put my question in to it. Any help is appreciated.

    Assume I want to create a search employee page for my company, the employees are categorized by his or her department and the province he or she is in. I have in the database a look up table for department and province. (as shown in the image below)

    3-5-2013 5-53-51 PM.png
    http://oi46.tinypic.com/idvpsl.jpg

    So I create three JPA entities, one for each table. Now I am stuck with what is the proper way to design the session facade design pattern. I know that I will need the to access all three entities in my page. (to get the drop down list for Provinces and Departments, and to retrieve list of Employees based on the selection) So should I create a Stateless Session Bean as session facade to access all three JPA Entities or should I create three separate Stateless Session Bean to manage one Entity each?

    I came up three component diagram in the below picture.
    The first one has one Stateless Session Bean as session facade and manages all three Entities.
    The second one has a session facade to manage the relationship between business objects such as ProvinceManagerEJB and DepartmentManagerEJB which will manage the corresponding Entities.
    The last one has three Stateless Session Beans that will manage one Entity each, all three Stateless Session Beans can be looked up via the Business Delegate pattern.

    3-5-2013 6-01-10 PM.jpg
    http://oi46.tinypic.com/10pqets.jpg

    Please let me know if any one of them is the proper way to use business delegate and session facade. or none of them is correct. (which I assume might happen)

    Again, thank you so much for your help.

    Cheers


  2. #2
    Junior Member
    Join Date
    Apr 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Business Delegate and Session Facade usage.

    Session Facade is not a commonly used pattern. Pick up a copy of Martin Fowler's Patterns of Enterprise Application Architecture to learn more.

    Business Delegate is more common but most architects I know don't use that either. Sun/Oracle did a nice job of trying to establish common patterns (i.e. Pet Store). Unfortunately the term "Design Pattern" was created to document common patterns in use. Sun suggested an architecture based partly existing (real) design patterns, and new patterns, which they also called Design Patterns, stretching the definition.

    In my experience, most good architects tried the "Pet Store" patterns and moved on. Check out the Grails framework. It's architecture is based on (again, in my experience) the most popular Java Web architectural approach. I learned this from guru's I met along the way, and when Grails came out, it's architecture was completely familiar to me.

Similar Threads

  1. Using Pictures with a ComboBox for my business need help
    By loui345 in forum Java Theory & Questions
    Replies: 1
    Last Post: January 26th, 2013, 07:02 PM
  2. name for project business
    By BLUEJ in forum The Cafe
    Replies: 2
    Last Post: December 19th, 2012, 11:06 AM
  3. Business Rules in IU AVLTree Applet
    By glaydersonjonathan in forum AWT / Java Swing
    Replies: 3
    Last Post: September 24th, 2012, 11:06 PM
  4. why business logic should be moved out of JSP ?
    By nithinurs in forum Java Theory & Questions
    Replies: 1
    Last Post: April 28th, 2011, 11:40 AM