使用Hibernate Envers审计ManyToMany关系 [英] Audit ManyToMany Relationships using Hibernate Envers

查看:83
本文介绍了使用Hibernate Envers审计ManyToMany关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Hibernate Envers来审计我的实体。但我有一个问题。我想审计一个具有ManyToMany关系的实体。我发现存在一个@AuditJoinTable,但我不知道它是如何工作的。有人可以举一个例子吗?

解决方案

审核多对多关系应该可以在没有任何额外配置的情况下工作,关系被审核。

对于 @AuditJoinTable ,注释用于指定自定义表名连接表。参见:



http://docs.jboss.org/hibernate/orm/4.1/javadocs/org/hibernate/envers/AuditJoinTable.html



默认名称是 [引用实体名称] _ [引用实体名称] _AUD 。如果默认表名称正确,则不必使用注释。


I'm using Hibernate Envers in order to audit my entities. But I have a problem. I want to audit an Entity that have a ManyToMany relationship. I found that exists an @AuditJoinTable but I don't have idea how it works. Can someone giveme an example?

解决方案

Auditing many-to-many relations should work without any additional configuration, provided that both sides of the relation are audited.

As to @AuditJoinTable, the annotation is used to specify a custom table name of the join table. See:

http://docs.jboss.org/hibernate/orm/4.1/javadocs/org/hibernate/envers/AuditJoinTable.html

The default name is [Referencing entity name]_[Referenced entity name]_AUD. The annotation doesn't have to be used, if the default table name is fine.

这篇关于使用Hibernate Envers审计ManyToMany关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆