On 7/12/07, Dale Newfield <[EMAIL PROTECTED]> wrote:
Michael Horwitz wrote: > Matt is right - it definitely should work. I'm pretty sure I have done > this in the past without issue. Do you use spring1.x or spring2 ? I keep thinking my problem has to be in applicationContext-service.xml, and I was looking for other (working) files to compare mine against...
I use Spring 2.0.x as per AppFuse 2.0x. Looking at your stack trace all looks good - it should go through the same stack twice, just that the first time it should start a new transaction, and the second time it should simply re-use the existing transaction. Any chance your action calls two managers and passes in an object obtained from the first manager to the second? Also just to check that it is the same transaction interceptor that intercepts both methods (i.e. you don't have a customized tx interceptor on the second method invocation)? Could you also post a snippet as to how you go about obtaining a session in the relevant DAO's? It could be the DAO's are explicitly opening a new session rather than re-using an existing one.
In terms of transaction/session handling the OpenSessionInViewFilter > should take care of making sure the session is opened/closed once per > request. The tx advice interceptors on the manager methods should > open and close transactions on the same session - so you should > definitely not have lazy loading issues. And by default transactions > should be propogated. Yes--I would claim that the most annoying problems with software in general are when something "should" work, but doesn't. :-)
Yup - agreed! And 90% of the time it usually boils down to a typo/ommission on my side :-) Mike.
One thing to check - everything is thread based. I'm assuming you are > not spawning another thread to call the second manager? Nothing strange going on thread-wise in this action or in the business logic in question. (Elsewhere in the webapp I do have an action that uses execAndWait for a long-running task, and does a dance to get the session to stay open until that spawned thread is complete, and that works like a charm.) Any other suggestions? -Dale --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]