It has been discussed many times but here we are once again. Please read on...
I need to design an application that has a shopping cart. And I know a few basic designs but can not decide which one is better. I would appreciate any thoughts. We will use clustered JBoss and it is going to be non-sticky (not my choice). Session is set up as replicated across cluster for SET/GET. I am not yet sure about the number of users of the system but I would like to design something that is as good for a 100 concurrent users as for a 1000 (if that ever happens). This is going to be struts application so every servlet is an action.
To manage (add/delete) items to a shopping cart I can do
1.servlet that makes calls to DB through helper or factory and returns item's details for specified item by items id
2.stateless session bean. For every incoming request I get home interface and create bean and then bean calls DB and gets item by item's id 3.stateless session bean as above but works as a facade for entity bean for adding items.
4.statefull session bean to keep added items ids list and make calls to DB(say I keep component reference to the bean in HttpSession or I keep beans' handle in HttpSession) since session is replicated cluster should be supported just fine 5.statefull session bean that works as a facade for entity beans. Keep reference in session as in N4
Which one is the best approach? I understand that we are moving away from simple "servlet to DB calls" towards having SFSB as a facade for entity but I do not really see an advantage unless I need complicated transaction management.
Are there any advantages of using SLSB or SFSB as a facade for entities versus those SLSB and SFSB executing sql statements directly ? Is there any advantage of using that versus plain old servlet executing sql statements? I mean all of it wrapped up in factories and such?