Results 1 to 2 of 2

Thread: Compound Transactions

  1. #1

    Default Compound Transactions

    Hello,

    My question relates to programmatic transactions. I am using the TransactionTemplate to execute TransactionCallback implementations.

    I have two of these TransactionCallback implementations in seperate packages. One of these makes a call to the DAO object, writing or deleting an object and also performing another task with that object, all wrapped in a doIntransaction() method.

    The other TransactionCallback implementation makes a call to another DAO. I want to make the second TransactionCallback implementation make a call to the first TransactionCallback implementation. My question is if I make that call from within the second TransactionCallback implementation doIntransaction() method and an exception and roll back occurs in the first TransactionCallback implementation, will the calling second TransactionCallback implementation automatically roll back or do I have to trow the exception again in the first TransactionCallback ?

    Many thanks in advance and appologies if this is a dumb question!

    John.

  2. #2
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,424

    Default

    If I understand you correctly, you have TransactionTemplate that ends up calling into another tranasction template. If a RuntimeException gets thown within the second one, they will both be rolled back. The TransactionTemplate basically rolls back and then re-throws the exception. If in doubt you can always have a look at the source code.

Posting Permissions

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