问题
I am using hibernate in Spring.I also use ENVERS for auditing.
I need to disable auditing for one particular transaction. Does ENVERS support this?
回答1:
Yes, but it's certainly not very straight-forward.
What you need to do is to implement conditional auditing, see documentation for details. The gist is that you'll need to present your own various Envers listener implementations which would fire and need to check some value you've set as a part of the transaction to veto the audit listener's actions.
I do have a proposal for enhancing the conditional auditing process, HHH-11326. Feel free to comment there with any additional thoughts you have on the feature.
来源:https://stackoverflow.com/questions/33430885/can-i-make-a-particular-transaction-disable-auditing-using-envers