On Tue, Feb 25, 2003 at 03:38:11PM -0500, James Cook wrote: > On Tuesday, February 25, 2003, at 02:54 PM, Anders Engström wrote: > > >We want each HTTP-request to run under the scope of one transaction in > >the business layer. This is where I need some advice - how do we best > >utilize WW to achieve this? > > Most of the transactions in our application are initiated on the server > when we make a call to a SLSB, however in those few cases where we need > to enforce a transaction for the entire scope of an HTTP request we use > the UserTransaction object. >
That makes sense. Check the comments on UserTransaction further down. > >We want to use action chaining, so I thought of writing a > >WWActionExecutioner (Stateless Session EJB) that receive all actions > >to execute in a request. This bean would have one method - execute(List > >actions) : String - with transaction attributes set to 'required'. This > >way each action can perform business calls on different sessions beans > >under the same transaction. > > Sorry but this doesn't make much sense to me. When you say Actions, I > guess you are not referring to WW actions. If you are, I think you may > need to re-read some documentation. :-) It doesn't make sense? I'm not sure I understand which documentation I should read, but please let me know. The idea is to make the actions "mobile" and move their place of execution to the EJB-container. This way you minimize the amount of network use - instead of letting each action look up resources in the EJB-tier and do RPC (== expensive network roundtrips), you send the actions to the EJB tier and let them execute in batch mode. (The same reason you use value objects instead of letting the web tier access entity beans directly). > >Looking at the codebase (CVS) it looks like this should be doable by > >"remoting"/wrapping GenericDispatcher as an EJB. > > Gotta comment myself here... wrapping GenericDispatcher is not a good idea... the WWActionExecutioner should be light-weight :) > >The above ought to be a pretty common scenario - so I would appreciate > >comments, advices etc. :) > > umm...I guess you _did_ mean WebWork actions... > > There are a bunch of ways to get a transaction to wrapper the entire > HTTP call if you want to go to that extreme. Here are a couple: > > 1. Subclass ActionSupport to create a UserTransaction before execute(), > and stick it in the request. If you chain to another action, you want > to check if a UserTransaction is currently active. If it is, you do > nothing as you don't want to create nested transactions. After > execute(), you issue your commit. You can rollback if there is a > problem. > This sounds Ok - but this might generate a lot of network round-trips from the web-tier <-> ejb-tier. > 2. Use a filter to implement similar logic. > This is also a solution I've been thinking about. //Anders -- |===================================| | Anders Engström | | [EMAIL PROTECTED] | | http://www.gnejs.net | |===================================| |Your mind is like an umbrella. | |It doesn't work unless you open it.| | /Frank Zappa | |===================================|
pgp00000.pgp
Description: PGP signature