db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Kaye <mich...@mxtelecom.com>
Subject Re: Data Auditing
Date Fri, 15 Dec 2006 18:08:17 GMT
Federico Fissore wrote:
>> I have a requirement to create audit history (in an audit table for every
>> actual table in the db) when data gets updated. I do not want to write
>> triggers in the db as the applications is db agnostic. With torque what is
>> the best way to write the audit logic – should I change the do<action>
>> methods to perform the audit along with the action?
> 
> IMHO one nice way is to edit the java classes Bean.java (which extends
> BaseBean.java) and override the method "save" to do something before
> saving
> I do that to update "modified on date" columns
> 

I Know this might be a bit off-topic, but you might want to see if you
can integrate some sort of AOP programming style into your logic -- we
use it to alter modified dates and modified users on beans before we
save to the database, to provide a basic form of auditing in some cases.
Perhaps intercepting the save methods would be cleaner than altering
your Bean.java.

A framework that handles this really easily is the Spring framework.
(www.springframework.org)

Michael


-- 
Michael Kaye
Senior Software Developer
MX Telecom
Tel: 0845 6667778

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message