Back Forum Reply New

How to make 2 JDBC calls as a single Transaction

Hi
I have multiple JDBC calls and want to roll back the entire service if anyone of them fails. How to achive this. Any advice is appreciable.
Thanks
-CHandu

You can use the TransactionTemplate.  I just had to do this myself.   It's referenced in the docs:

sp...ansaction.html

Basically you have to instantiate a TransactionTemplate object and call execute with appropriate callback( TransactionCallback()  or TransactionCallbackWithoutResult())

I suggest you to read the chapter about transactions in the reference guide. It explains it quite clearly.

Basically it comes down that your transactions need to be defined on your service not on your data layer.
¥
Back Forum Reply New