I have the following scenario
I have a webapp in which the web.xml has an applicationcontext created using contextloaderservlet with a set of xml files defining the beans.
I also refer in the webapp another jar file in which a class creates another applicationcontext using classpathapplicationcontext with a set of xml files definfing beans.
In one of the scenario a MgrbeanA invoked by a controller in the webapp is obtained from TransactionProxyFactory and the MgrbeanA further calls another MgrBeanB defined in the applicationcontext that was created by the class in the jar file which is also obtained from a TransactionProxyFactory.
In effect the code looks something like this in the MgrBeanA in the WebApp
The issue i'm facing currently is , if there is an exception raised in performActionTwo() i expect the whole operation being rolled back, but the actually what happens is the callMgrBeanInJarToPerformActionInDB(); is committed irrespective of what happens in MgrbeanA.
As these are two different applicationcontexts the datasources referred in these contexts are also different.
Is my approach correct, should i be,
1. not define datasources seperate if i want to propogate the transaction
2. merge my application contexts into one
3. make the application contexts hierarchial
i tried to read thru the documentation and the forum posts, but i'm not sure of which approach to take..
also i have another clarification, if i want to have an applicationcontext defined in the webapp so that the cotroller can invoke it, how do i ensure the other applicationcontexts i define will be part of the appcontext i defined in webapp, and how do i access the beans if i dont have servletcontext available else where.
can any one help me out on this...thanks in advance..