Search code examples
springhibernatespring-mvchibernate-envers

use of hibernate envers 4.2 with hibernate 3.5.5


Is it possible to use hibernate envers 4.2 with hibernate 3.5.5 because I have to use some of the features of envers 4.2 but due to some constraints I can not upgrade my hibernate core version. I am using hibernate 3.5.5 with spring 3.2 and below is my configuration file.

 <bean
        id="TransactionalSessionFactory"
        class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean" >
        <property name="dataSource" ref="TransactionalDataSource" />
         <property name="hibernateProperties" >
            <props>
            <prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>
                <!-- <prop key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</prop> -->
                <prop key="hibernate.show_sql">true</prop>
                <prop key="hibernate.connection.autocommit">false</prop>
            </props>
        </property>
        <property name="eventListeners">
           <map>
           <entry key="post-insert">
             <bean class="org.hibernate.envers.event.AuditEventListener" />
           </entry>
            <entry key="post-update">
             <bean class="org.hibernate.envers.event.AuditEventListener" />
           </entry>
            <entry key="post-delete">
             <bean class="org.hibernate.envers.event.AuditEventListener" />
           </entry>
            <entry key="pre-collection-update">
             <bean class="org.hibernate.envers.event.AuditEventListener" />
           </entry>
            <entry key="pre-collection-remove">
             <bean class="org.hibernate.envers.event.AuditEventListener" />
           </entry>
            <entry key="post-collection-recreate">
             <bean class="org.hibernate.envers.event.AuditEventListener" />
           </entry>  
           </map>
        </property>
        <property name="annotatedClasses" >
            <list>
                <value>x.y.z.LocDtls</value>
                <value>x.y.z.AnnotatedTrackingRevisionEntity</value>
           </list>
        </property>
     </bean> 

During deployment It is giving me following error.

Caused by: java.lang.ArrayStoreException: org.hibernate.envers.event.AuditEventListener

Kindly help me if any one has used hibernate envers with hibernate template. thanks in advance


Solution

  • No, major releases tend to include API and SPI changes which break integrations between Hibernate and both its sister projects and third-party projects.

    So if you need to use Envers 4.2, the only supported strategy is to upgrade Hibernate to 4.2 too.