I am using Spring 1.2.6, Hibernate 3.0.1
I have one interface and its implementor defined as
I have applied transaction on method calls of A >> AImpl using spring's decalrative transaction.Code:public interface A { public void methodA1() throws DataAccessException; public void methodA2() throws DataAccessException; } public class AImpl extends HibernateDaoSupport implements A { public void methodA1() { ..... } public void methodA2() { ..... } }
So when method of A >> AImpl is called, transaction starts and commited when execution returns from the method.
Consider the following code, where "a" is a reference of interface A
In the above example, when methodA1() is called, transaction is started and commited when returned from methodA1(). When methodA2() is called, again transaction is started and commited when returned.Code:.... a.methodA1(); ....[some other code here] a.methodA2(); ....
What I want to do, I want to run these two method calls in the same transaction.
How can I do that?
I think, I have to start the transaction programmatically and attach it to the current thread beore calling methodA1() and commite it when returned from methodA2().
How can I do it?


Reply With Quote