audit log for any persisted changes, without using database triggers, instead use spring/hibernate

StackOverflow https://stackoverflow.com/questions/9131061

Pregunta

Everytime a user makes an alteration to a record and saves it. I want an audit log for that change. Say for example we have a customer table and the gui shows customer info and sales, I also want to the gui to show an audit log for that customer. Who by and when every change was made to customer.

I could use database triggers and on every insert/update/delete create a new record in a log table (be it one log table for all tables, or one each e.g. customer_log).

However, I am using Spring 3.1 and hibernate 4 and was trying to keep everything (business logic) in Java and outside of the database and spocs/triggers. I have the idea that spring aop might be appropriate ... ?

For every session.save(myEntity) that occurs on my system, I also want to do an session.save(myEntityLog) ?

¿Fue útil?

Solución

You have at least two choices for frameworks thad handle this in the application Lazyer

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top