Yeah.. that makes
sence - sorry to miss you point about applying the transaction interceptor to
'both' actions :)
Thanks, I
appreciate you taking the time to help.
Cameron
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jason Carreira
Sent: Wednesday, 16 July 2003 6:23 AM
To: [EMAIL PROTECTED]
Subject: RE: [OS-webwork] WebWork2 Action Chains and Interceptors
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jason Carreira
Sent: Wednesday, 16 July 2003 6:23 AM
To: [EMAIL PROTECTED]
Subject: RE: [OS-webwork] WebWork2 Action Chains and Interceptors
Ok, let me try again. Here's the order of execution:Action1 Interceptors - beforeAction1 - executeResult -> ActionChainingResultAction2 Interceptors - beforeAction2 - executeResult -> JSPAction2 Interceptors - afterAction1 Interceptors - afterNow if you have the TransactionInterceptor applied to BOTH Actions, and the before does basically this:if (getThreadLocalTransaction() == null) {Transaction tx = ....setThreadLocalTransaction(tx);} else {commitTransaction();Transaction tx = ....setThreadLocalTransaction(tx);}and the after does this:if (getThreadLocalTransaction() != null) {commitTransaction();}protected void commitTransaction() {getThreadLocalTransaction().commit();setThreadLocalTransaction(null);}then you should get the behavior you want.Action1 Interceptors - before will create a transactionAction2 Interceptors - before will commit the outside transaction and create a new oneAction2 Interceptors - after will commit the second transactionAction1 Interceptors - after will do nothingYou could break this into 2 Interceptors if you want, or parameterize the TransactionInterceptor for different behavior (commit outer transaction? ignore outer transaction? etc)Jason-----Original Message-----
From: Cameron Braid [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 15, 2003 4:02 PM
To: [EMAIL PROTECTED]
Subject: RE: [OS-webwork] WebWork2 Action Chains and InterceptorsI am using a threadlocal for both the session and transaction objects.The issue - which you seem to have missed - is that the chained FROM action's interceptors are executed around the chained TO action.This happens because the chain is implemented as a result which is a part of the chained FROM action's invocation.I will just adopt object orientation once again .. how about that eh ! and use a superclass to implement the transaction container.