在一个持久对象中,如果我只更改一个字段,是否可以仅通过 Hibernate 找出更改的字段? 我知道我可以获得整个旧行和新行并进行比较。
最佳答案
根据您的一条评论,我的理解是您正在寻找审计解决方案,因此我建议查看 Envers这正是关于这个。
The Envers project aims to enable easy auditing/versioning of persistent classes. All that you have to do is annotate your persistent class or some of its properties, that you want to audit, with @Audited. For each audited 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.
关于java - 有没有办法使用 Hibernate 只从对象中获取更改的列?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2521575/