Frage

Our team is stuck on a choice between Hibernate Envers and Spring AOP. Basically, we would like to audit database transactions, especially when a user deletes an object from the database. However, we do not want to audit all the tables. We understand that with Spring AOP, we can use this as a cross-cutting concern and whenever the delete() method is executed in the DAO, we can then record the delete. Our question is: Is Hibernate Envers easier and more suited to this problem or is Spring AOP an acceptable solution? Any direction, with some evidence, would be very much appreciated by our team.

War es hilfreich?

Lösung

I have just started using Hibernate Envers for auditing and so far I am very much satisfied with it. Pros:
1. We literally don't have to write a single line of code.
2.It also captures the userName and timestamp automatically through RevisionEvent, a very simple thing to configure.
3.the code follows JPA annotations, not hibernate.
4.Well if someone is using hibernate then why not use its entire feature.
5.This feature(Envers) is developed specifically to capture auditing. People are continuously working on upgrade and making it more user friendly.
6.One can write his own event listeners like for update,delete,insert etc:
Cons:
1.Creates lots of AUD_ tables. However we can configure the table which we want to AUDIT.
2.It will never capture HQL queries automatically.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top