java - 有没有办法使用 Hibernate 只从对象中获取更改的列?

标签 java hibernate orm

在一个持久对象中,如果我只更改一个字段,是否可以仅通过 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/

相关文章:

java - 如何设置数据绑定(bind)中包含布局的可见性?

java - 将 JSON 数据插入 MYSQL 的最佳方法

mysql - 如何锁定事务以读取一行然后插入 Hibernate?

java - Android Activitynotfound 错误?

java - 如何将程序合并到博客中

java - 在我的 Spring 应用程序中配置 hibernate 的问题

java - 为什么 Hibernate query.list() 很慢?

python - SQLAlchemy 生成错误的 SQL(对于别名和自连接)?

python - 如何使用 django ORM 在外键字段上连接两个表?

java - 为什么 id 字段不能在 EclipseLink 的 where 子句中使用