存在注释时创建 Envers 的 EntityManagerFactory 时出错
恩弗斯看上去很轻松。只需在 persistence.xml
(事件监听器)中添加一些 hibernate 属性,并注释您要审核的实体。
我正在使用 Hibernate 的应用程序上对此进行测试。这是一些pom信息:
- org.hibernate.hibernate-entitymanager:3.4.0.GA
- org.hibernate.hibernate-annotations:3.4.0.GA
- org.hibernate.hibernate:3.2.6.GA
- org.jboss.envers.jboss -envers:1.2.1.GA-hibernate-3.3
如果我插入无注释,我的应用程序上下文加载正常。但如果我插入一个,我将无法构建 EntityManagerFactory。
(...) Caused by: java.lang.NullPointerException at org.hibernate.envers.configuration.metadata.AuditMetadataGenerator.generateInheritanceMappingData(AuditMetadataGenerator.java:305) at org.hibernate.envers.configuration.metadata.AuditMetadataGenerator.generateFirstPass(AuditMetadataGenerator.java:353) at org.hibernate.envers.configuration.EntitiesConfigurator.configure(EntitiesConfigurator.java:87) at org.hibernate.envers.configuration.AuditConfiguration.(AuditConfiguration.java:86) at org.hibernate.envers.configuration.AuditConfiguration.getFor(AuditConfiguration.java:99) at org.hibernate.envers.event.AuditEventListener.initialize(AuditEventListener.java:260) at org.hibernate.event.EventListeners$1.processListener(EventListeners.java:198) at org.hibernate.event.EventListeners.processListeners(EventListeners.java:181) at org.hibernate.event.EventListeners.initializeListeners(EventListeners.java:194)
任何帮助将不胜感激。
Envers looks easy. Just add some hibernate properties in your persistence.xml
(eventlisteners), and annotate the entities you want to audit.
I am testing this on an application using Hibernate. Here is some pom info:
- org.hibernate.hibernate-entitymanager:3.4.0.GA
- org.hibernate.hibernate-annotations:3.4.0.GA
- org.hibernate.hibernate:3.2.6.GA
- org.jboss.envers.jboss-envers:1.2.1.GA-hibernate-3.3
If I insert no annotations, my app context is loaded fine. But if I insert one, I am unable to build EntityManagerFactory.
(...) Caused by: java.lang.NullPointerException at org.hibernate.envers.configuration.metadata.AuditMetadataGenerator.generateInheritanceMappingData(AuditMetadataGenerator.java:305) at org.hibernate.envers.configuration.metadata.AuditMetadataGenerator.generateFirstPass(AuditMetadataGenerator.java:353) at org.hibernate.envers.configuration.EntitiesConfigurator.configure(EntitiesConfigurator.java:87) at org.hibernate.envers.configuration.AuditConfiguration.(AuditConfiguration.java:86) at org.hibernate.envers.configuration.AuditConfiguration.getFor(AuditConfiguration.java:99) at org.hibernate.envers.event.AuditEventListener.initialize(AuditEventListener.java:260) at org.hibernate.event.EventListeners$1.processListener(EventListeners.java:198) at org.hibernate.event.EventListeners.processListeners(EventListeners.java:181) at org.hibernate.event.EventListeners.initializeListeners(EventListeners.java:194)
Any help would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
org.jboss.envers.jboss-envers:1.2.1.GA-hibernate-3.3 与 hibernate-3.3 一起使用
您尝试使用较新的版本吗?
org.jboss.envers.jboss-envers:1.2.1.GA-hibernate-3.3 works with hibernate-3.3
did you try to use newer version?