• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Part II Design Decisions: JPA and Business Delegates

 
Jose Selman
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Gurus, I'm working on part II of the SCEA5 exam. I would appreciate your comments on the following:

* I want to use JPA in my design. However I'm still trying to figure out how to show this in the UML Class Diagram. I don't want to copy the classes from the provided domain model specifying an "Entity" StereoType for each. Any pointers? I want to have a Stateless Session EJB in front of the entities as the "Orchestra Director".

* Since I'm using JEE 5 I guess that I can use Dependency Injection to locate EJBs (from managed components) so there's no need to create a Business Delegate. However, the B.D. pattern decouples the Web Tier from the Business Tier. So both approaches "race" each other. Any comments?

Best Regards,

Jose M. Selman
 
Pratik Das
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In Sun's version of class diagram we show the domain model classes with complete relationships and sessionBeans as given in Mark Cade's book.You do not need to show JPA here since it is meant to be technology neutral. I am not an SCEA so suggest you wait for the views of other experts.
 
Alex Pavlishin
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
* I don't see anything wrong with using the classes provided in the business domain model and stereotyping them with Entity stereotype. For you Orchestra Director stateless session bean, you can use the Model Facade pattern. It is described very well in the Java EE blueprints at https://blueprints.dev.java.net/bpcatalog/ee5/persistence/ejbfacade.html


* The BusinessDelegate is meant to separate presentation tier logic from business logic. Also, you can handle container specific exceptions in your Business Delegate classes and only pass application specific exceptions to the business tier. And if your project requirements are such that you might need multiple presentation tiers in the future, having a common entry point with a Business Delegate can be very helpful.

However, since the Business Delegate is a POJO, you will not be able to use dependency injection to look up your Session Facade classes. You will have to use a Service Locator design pattern to do that.
 
Pratik Das
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you can still use dependency injection by means of a setter method in your business delegate and receiving the reference from the calling managed component(which has access to the resource by means of DI).
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where you may have been tempted to put a business delegate, could you put a service object instead? Service objects are great!

-Cameron McKenzie
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic