Hibernate envers - How to store only updated values

后端 未结 2 434
既然无缘
既然无缘 2021-01-22 09:47

I am using Hibernate Envers for my Auditing. Post-update and post-insert works fine.

I have a requirement where I need to audit only the updated columns in the audit tab

相关标签:
2条回答
  • 2021-01-22 09:57

    What happens if you dont configure envers listener for post-insert?

    I mean if you take out post-insert listener from your config?

     <listener class="org.hibernate.envers.event.AuditEventListener" type="post-insert"/>
    
    0 讨论(0)
  • 2021-01-22 10:12

    When you annotate an entity with @Audited, you're controlling which properties Envers should inspect when changes occur. Those properties are then compared between the old and new state and if any differ, Envers will write a new audit record with the new state values for all audited properties.

    In other words, Envers won't write a new audit row with only the modified properties you have toggled for audit. It will write a new audit row with all audited properties if any of them change.

    0 讨论(0)
提交回复
热议问题