Results 1 to 2 of 2

Thread: Spring + Hibernate + Quartz

  1. #1
    Join Date
    Jan 2005
    Posts
    3

    Post Spring + Hibernate Transaction problem

    I am using Spring 1.2.6, Hibernate 3.0.1

    I have one interface and its implementor defined as

    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() {
             .....
       }
    
    }
    I have applied transaction on method calls of A >> AImpl using spring's decalrative transaction.
    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
    Code:
    ....
    a.methodA1();
    
    ....[some other code here]
    
    a.methodA2();
    
    ....
    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.

    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?
    Last edited by avi129; Jan 18th, 2006 at 11:47 PM.

  2. #2
    Join Date
    Jan 2005
    Posts
    3

    Default

    I solved the problem using org.springframework.transaction.support.Transactio nTemplate.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •