Results 1 to 3 of 3

Thread: Declarative transaction will not work when .... ?

  1. #1
    Join Date
    Nov 2004
    Posts
    17

    Default Declarative transaction will not work when .... ?

    Hi,

    I have declared ClassA.methodX() as PROGATAION_REQUIRED.
    The transaction mechaism works fine, when other object
    invokes ClassA.methodX() directly. If methodX() throws Exception, all data are rollback successfully.

    But if I create another method as ClassA.methodY(),
    which has no transaction property, and it will invoke ClassA.methodX(),
    such as:
    Code:
    ClassA {
    
        public void methodY() {
                this.methodX();
         }
         
        public void methodX() {
                ....
         }
    
    }
    Then another object invoke methodY() first,
    -> methodX() is ivoked -> methodX() throws Exceptions,
    data are not rollback !?

    Is it normal?

    ps. methodX() will invoke other methods, some are also declared as PROGATAION_REQUIRED

    ps. I am using Spring 1.1.1

    Thanks for any comment!

  2. #2

    Default

    I'm not sure I understand your example exactly, but take a look at this:

    http://forum.springframework.org/showthread.php?t=11656

    In summary, calling methods via the this reference bypasses the transaction proxy. You must direct intra-object calls through the proxy.
    Last edited by robyn; May 19th, 2006 at 04:47 AM.

  3. #3
    Join Date
    Nov 2004
    Posts
    17

    Default

    Quote Originally Posted by rhasselbaum
    I'm not sure I understand your example exactly, but take a look at this:

    http://forum.springframework.org/showthread.php?t=11656

    In summary, calling methods via the this reference bypasses the transaction proxy. You must direct intra-object calls through the proxy.
    Dear rhasselbaum,
    I think you understand my problem.
    Thanks for your comment, it helps me a lot.

    It looks like I cann't just write business methods too feely....

    Is there any more official document to talk about this topic?

    Thanks!
    Last edited by robyn; May 19th, 2006 at 04:48 AM.

Similar Threads

  1. Unit testing with JOTM and JtaTransactionManager
    By lalle in forum Architecture
    Replies: 1
    Last Post: Oct 15th, 2005, 09:05 AM
  2. Replies: 0
    Last Post: Jun 6th, 2005, 06:22 AM
  3. Replies: 3
    Last Post: Nov 19th, 2004, 07:16 PM
  4. Transaction pb Hibernate/MySQL
    By syluser in forum Data
    Replies: 2
    Last Post: Aug 28th, 2004, 02:40 PM
  5. Replies: 1
    Last Post: Aug 19th, 2004, 12:37 AM

Posting Permissions

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