Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Transaction History

 
sasala shah
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am working on a financial web application in which i need to store each transaction performed on a particular user account with the old data(before executing the transaction) and the new data(after executing the transaction) and possibly need to reverse it if user wants to do so.

We are using JAVA with iBATIS as a persistence framework.

I don't know how i am going to implement this. initially i thought of storing xml of old and new data but dont have any clue on that.

Anybody has come across such scenario?

Thanks,
Sam
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you implement this at the database level through a trigger?

-Cameron McKenzie
 
sasala shah
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried doing that but Triggers are event based and i want to keep it transaction based.
So Triggers will not work. Also I need to reverse the transaction if user wants.
 
John Bengler
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sasala,

at least the triggers I know share your session (if you want them run outside of your session you have to use pragma autonomous_transaction in oracle, e.g.), so all changes will be rolled back, if you perform a rollback in your session.

You can also have alook to this: populate history table

This primarely covers SQL Server techniques (e.g. Change Data Capture (CDC), but the trigger examples should work for other DBs, too.. Of course they will have to be adapted to the different syntax of your DB.


John
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic