-
Feb 28th, 2007, 06:11 PM
#1
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.
-
Mar 1st, 2007, 02:25 PM
#2
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
-
Forum Rules