I have a Java Swing Application that use JPA 2 for database access. I need to add auditing features to the application (not using database triggers).Very same requirements indeed (hey maybe we're even colleagues! :o)
For example the customer object is retrieved and update the UI with the customer object values. When the user presses the Save button on the form, I would like to add an audit entry to the database with before and after values (change values only of course).As I said, I'm not aware of best practices for this, but my current thinking goes along this (multiple solutions, if anyone wishes to comment be my guest):
Is there any best practice design pattern for acheiving this?
jduprez wrote:Analyze the business requirements first.
2) Specifically, the DAO layer seems like a good place: it's more appropriate to manage the transaction at this layer.