简体   繁体   English

即使使用@Audit注释实体,也不会注册Hibernate Envers审计侦听器

[英]Hibernate Envers Audit Listeners are not registered even though entity are Annotated with @Audit

I have Spring4.1.2, Hibernate 4.2.18, Jboss 6 application. 我有Spring4.1.2,Hibernate 4.2.18,Jboss 6应用程序。 I have configured entities and a custom revision entity. 我已经配置了实体和自定义修订版实体。 But still Envers listeners are not registered to listenerRegistry. 但是Envers侦听器仍未注册到listenerRegistry。

I tried to debug the enverse source and found that source [EnversIntegrator.integrate method] is skipping listeners as it could not find any audit tables. 我尝试调试反向源,发现源[EnversIntegrator.integrate方法]正在跳过侦听器,因为它找不到任何审核表。

I also found the root cause also. 我也找到了根本原因。 when I dig into deeper, this code 'clazz.getAnnotation(Audited.class)' inside AnnotationsMetaDataReader.getDefaultAudited method always returns null. 当我深入研究时,AnnotationsMetaDataReader.getDefaultAudited方法中的这段代码“ clazz.getAnnotation(Audited.class)”始终返回null。 I am sure that Audited annotation is present in entity class. 我确信实体类中存在Audited注释。

This seems to be strange as it is working perfectly for another sample application. 这似乎很奇怪,因为它可以完美地用于另一个示例应用程序。

This seems to be a class load issue. 这似乎是一个类加载问题。 Please ensure that required envers are in place. 请确保已安装所需的转换器。

Is your application uses Jboss module 'org.hibernate' instead of hibernate jars in War? 您的应用程序是否使用Jboss模块“ org.hibernate”而不是War中的休眠jar? if so, configure jboss module 'org.hibernate.envers' in your application. 如果是这样,请在您的应用程序中配置jboss模块'org.hibernate.envers'。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM