File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Object Relational Mapping and the fly likes Transaction History Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Transaction History" Watch "Transaction History" New topic

Transaction History

sasala shah

Joined: Jun 26, 2009
Posts: 2
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?

Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968

Could you implement this at the database level through a trigger?

-Cameron McKenzie
sasala shah

Joined: Jun 26, 2009
Posts: 2
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

Joined: Feb 12, 2009
Posts: 133
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.

I agree. Here's the link:
subject: Transaction History
It's not a secret anymore!