Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Managing Transactions for SQL Updates

 
Royston Monteiro
Ranch Hand
Posts: 35
Java Linux Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Folks,
The DAO's I use currently, use JDBCTemplate for all SQL operations.
The application requires that a group of SQL updates should be done within a transaction, so that either all of them are committed together or all are rolled back.

I tried this with JDBCTemplate.batchUpdate, but it looks like each update within the batch is atomic, so a failure in one of them doesnt rollback the whole batch.

Please let me know if there is anyway to tweak JDBCTemplate so that we can control the atomicity of the batch.

I have found that org.springframework.transaction.support.TransactionTemplate is one way to manage transactions but I assume there would have to be major changes to include this. Or is it?


 
Suhas Bilaye
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Try doing transaction management using spring aop.. it might be easier..
I had faced the same problem i used the spring's transaction management api declaratively.. via aop..

Regards,
Suhas
 
Royston Monteiro
Ranch Hand
Posts: 35
Java Linux Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Suhas.

That solved the problem.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic