All, Any comments on the following design. Requirements: System should support transacation, large number of Clients , performance and business layer -Persistence layer isolation.
Scenario 1: Let Session Beans call directly DAOs. It fulfills all the above requirements excecpt maybe little performance hit, as SessionBeans starts transaction and DAOs does insert/delete/update/search operations. For each call, DAO instances are created and destroyed at the end. Drawbacks: Both business layer and perrsistence layer has to be in the same machine. Scenario 2:
Let Session Beans call directly to singleton DAOs. It also fulfills all the requirements, but not sure about thread safe of Singleton objects, as all the session beans ( concurrent threads) use the same instance of DAO, for insert/delete/search/update operations, without having any class variables. Drawbacks: Both business layer and persistence layer has to be in the same machine. Not sure about Thread safe of DAOs. Scenario 3: let session beans call to BMP which inturn calls singleton DAOs. BMPs offer transaction and caches the data if required, and uses the Singleton DAOs for all access to DB or any persistence service. Drawbacks: Not sure about Thread safe of DAOs. Scenario 4: Let session beans call to BMP which inturn uses DAOs. In this case, for each call from BMP, new DAO instance is created.
Drawbacks: Performance of system may go down, as each client call ends up creating new DAO instances.
I appreciate all you guys valuable comments. In all the above scenarios, I prefer scenario 4, as it suits all the above requirements, except small hit on memory and perfromance.