-
Aug 20th, 2012, 06:38 PM
#1
Spring 3 and Hibernate Enverrs 4
Hi Everybody:
I have trying to set up spring 3 and Hibernate Envers 4, but I couldnīt, please I need some recommendations about how to set up this version, If you have some settings about which version I should use and setting the pom.xml and the aplicacionConext.xml, I would be happy.
These is my currently
POM.xml
<!-- Hibernate -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.1.4.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-annotations</artifactId>
<version>3.5.6-Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.3.0.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate.common</groupId>
<artifactId>hibernate-commons-annotations</artifactId>
<version>4.0.1.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-envers</artifactId>
<version>4.1.4.Final</version>
</dependency>
applicationContext.xml
<bean id="com.axcessfinancial.tools.audit.entityManagerF actory" class="org.springframework.orm.jpa.LocalContainerE ntityManagerFactoryBean">
<property name="jpaProperties">
<props>
<!-- Listeners for Hibernate Envers -->
<prop key="hibernate.ejb.event.post-insert">
org.hibernate.ejb.event.EJB3PostInsertEventListene r,
org.hibernate.envers.event.AuditEventListener
</prop>
<prop key="hibernate.ejb.event.post-update">
org.hibernate.ejb.event.EJB3PostUpdateEventListene r,
org.hibernate.envers.event.AuditEventListener
</prop>
<prop key="hibernate.ejb.event.post-delete">
org.hibernate.ejb.event.EJB3PostDeleteEventListene r,
org.hibernate.envers.event.AuditEventListener
</prop>
<prop key="hibernate.ejb.event.pre-collection-update">
org.hibernate.envers.event.AuditEventListener
</prop>
<prop key="hibernate.ejb.event.pre-collection-remove">
org.hibernate.envers.event.AuditEventListener
</prop>
<prop key="hibernate.ejb.event.post-collection-recreate">
org.hibernate.envers.event.AuditEventListener
</prop>
<prop key="org.hibernate.envers.audit_table_suffix">_H</prop>
<prop key="org.hibernate.envers.revision_field_name">
AUDIT_REVISION
</prop>
<prop key="org.hibernate.envers.revision_type_field_name ">
ACTION_TYPE
</prop>
<prop key="org.hibernate.envers.audit_strategy">
org.hibernate.envers.strategy.ValidityAuditStrateg y
</prop>
<prop key="org.hibernate.envers.audit_strategy_validity_ end_rev_field_name">
AUDIT_REVISION_END
</prop>
<prop key="org.hibernate.envers.audit_strategy_validity_ store_revend_timestamp">
True
</prop>
<prop key="org.hibernate.envers.audit_strategy_validity_ revend_timestamp_field_name">
AUDIT_REVISION_END_TS
</prop>
</props>
</property>
</bean>
But when I am trying to run my test, It show me this message:
java.lang.IllegalStateException: Failed to load ApplicationContext
... 59 more
Caused by: java.lang.ClassNotFoundException: Could not load requested class : org.hibernate.envers.event.AuditEventListener
at org.hibernate.service.classloading.internal.ClassL oaderServiceImpl$1.findClass(ClassLoaderServiceImp l.java:99)
at java.lang.ClassLoader.loadClass(ClassLoader.java:3 06)
at java.lang.ClassLoader.loadClass(ClassLoader.java:2 47)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at org.hibernate.service.classloading.internal.ClassL oaderServiceImpl.classForName(ClassLoaderServiceIm pl.java:138)
... 60 more
I have sought on the Maven Dependency into hibernate-envers-4.X.X but I canīt find the class org.hibernate.envers.event.AuditEventListener, please what is the class that I need? I could be EnversListener, How to setting this new class on the applicationContext.
Thanks in advance.
Fred
-
Aug 21st, 2012, 02:13 AM
#2
Please use [ code][/code ] tags when posting code/xml/stacktrace so that we can easily read them, currently it isn't really readable..
I suggest a read of the hibernate reference guide how to configure envers, you are using the wrong way (as you probably already noticed by the stacktrace). For hibernate4 you don't need to configure all the post-* and pre-* listeners those are automatically registered if Envers is detected, so in short remove those.
-
Aug 21st, 2012, 09:23 AM
#3
Hi Marten,
Thanks for help me, could you give me what are the links where I can found this information or examples.
Thanks.
Fred
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules