Tuesday, December 09, 2008

A simple code revison for a JSF / EJB3.0 project

In my current J2EE project (JSF with EJB 3.0) , we did a simple code revision. The points of verification were:
  • Presentation tier (JSF)
    1. JSP mustn’t contain Java scriptlets.
    2. JSP must contain references to backing beans via JSF binding.
    3. Catalogs must be cached in a bean with scope “application”.
    4. Backing beans must use the Business Delegate in order to communicate with the business tier.
    5. When a Business Delegates helper invokes a Stateless Session Bean, the Business Delegates helper can be a singleton and the lookup can be done in the constructor. This way, there is only one Proxy and one JNDI lookup.
  • Business tier (EJB 3.0)
    1. There must be only one invocation to the business tier per request (with this restriction, we try to ensure that EJB services are coarse-grained business components).
    2. All the database access must be delegated to DAO classes.
    3. DAO mustn’t contain business logic.
It helped a lot :)

No comments: