Is it good to channel a single entry to the EJB tier ?


EJB design: Is it good to channel a single entry to the EJB tier ?

  1. The petstore application sample shows a single entry of the client tier to the middle tier.

    All the reqs are converted to events and they all go to a single state machine in the EJB controller tier . Is this the recommended design pattern ? What is the advantage of using this model ?

  2. It's MVC design pattern. You can read about its pros and cons at Sun's Website in J2EE blueprints (and many other places).

  3. I understood the MVC pattern, but I was wondering whether it is good to have a single session bean handle multiple workflows or to have multiple session facades for each workflow.

    After some more thinking, it makes sense that the single session bean access reduces the multiple lookup overhead which will come with the multiple session beans for each workflow.

  4. To solve the problem of frequent lookups, use the ServiceLocator pattern described in the J2EE Patterns page on the site. The ServiceLocator basically caches the home interface / stub. Thus there will be only one lookup ...