如何将envers注释放入XML映射元数据(orm.xml)文件中 [英] How to put envers annotations into XML Mapping Metadata(orm.xml) file

查看:128
本文介绍了如何将envers注释放入XML映射元数据(orm.xml)文件中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中,我使用XML Mapping Metadata作为注释的替代方法。到目前为止,它对所有JPA注释都正常工作。
但是对于审计,我使用Hibernate Envers。我声明

@Audited

@AuditTable(LOAN_APPLICANT_AUDIT)

唯一的问题是如何将这些注释放在XML映射元数据表单中。
要求用户指定需要审计的表的列表。

另外,他还应该根据自己的需要配置AUDIT表的名称。
最后一步是需要审计的表中的特定列名应该是可配置的。

In my application, I am using XML Mapping Metadata as an alternative to annotation. It worked fine for all the JPA annotations so far. However for Auditing, I am using Hibernate Envers. I am declaring
@Audited
@AuditTable("LOAN_APPLICANT_AUDIT")
The only problem is how to put these annotations in XML mapping metadata form. There is a requirement that the user should specify the list of tables, which needs to be audited.
Plus he should be also able to configure the name of AUDIT tables according to his needs.
The last step is that the particular column names inside a table which needs to be audited should be configurable.

推荐答案

目前这是不可能的。 Envers仅通过注解POJO来工作。有一个JIRA票据来启用XML配置,但它看起来并不像这个功能很快就会出现:

Currently that's not possible. Envers works by annotating POJOs only. There is a JIRA ticket to enable XML config, but it doesn't look like that feature will come anytime soon:

https://hibernate.atlassian.net/browse/HHH-3887

无论如何,如果你想使用Envers,你必须带注释。

Anyway, if you want to use Envers, you'll have to go with annotations.

这篇关于如何将envers注释放入XML映射元数据(orm.xml)文件中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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