Effective strategy for leaving an audit trail/change history for DB applications?

后端 未结 6 1654
有刺的猬
有刺的猬 2020-12-13 14:22

What are some strategies that people have had success with for maintaining a change history for data in a fairly complex database. One of the applications that I frequently

6条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-13 15:17

    If you are using Hibernate, take a look at JBoss Envers. From the project homepage:

    The Envers project aims to enable easy versioning of persistent JPA classes. All that you have to do is annotate your persistent class or some of its properties, that you want to version, with @Versioned. For each versioned entity, a table will be created, which will hold the history of changes made to the entity. You can then retrieve and query historical data without much effort.

    This is somewhat similar to Eric's approach, but probably much less effort. Don't know, what language/technology you use to access the database, though.

提交回复
热议问题