Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4047840
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T13:44:29+00:00 2026-05-20T13:44:29+00:00

I am working on a Spring and Hibernate web app. I have to use

  • 0

I am working on a Spring and Hibernate web app. I have to use Envers for auditing.
But when I am running the application only audit tables are created but no data is inserted to the audit tables.

Config file:

<mvc:annotation-driven/>

<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
  <property name="sessionFactory" ref="sessionFactory" />
</bean>    
<bean name="callbackHandler" class="org.hibernate.ejb.event.EntityCallbackHandler" />
<bean name="auditEventListener" class="org.hibernate.envers.event.AuditEventListener" />
<bean name="ejb3PostInsertEventListener" class="org.hibernate.ejb.event.EJB3PostInsertEventListener">
  <property name="callbackHandler"><ref bean="callbackHandler"/></property>
</bean>
<bean name="ejb3PostUpdateEventListener" class="org.hibernate.ejb.event.EJB3PostUpdateEventListener">
  <property name="callbackHandler">
    <ref bean="callbackHandler" />
  </property>
</bean>
<bean name="ejb3PostDeleteEventListener" class="org.hibernate.ejb.event.EJB3PostDeleteEventListener">
  <property name="callbackHandler">
    <ref bean="callbackHandler" />
  </property>
</bean>
<bean id="sessionFactory" name="sessionFactory"
  class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"
  lazy-init="false">
  <property name="dataSource" ref="dataSource" />
  <property name="annotatedClasses">
    <list>        
      <value>foo.bar.Person</value>
    </list>
  </property>

  <property name="hibernateProperties">
    <props>
      <prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>
      <prop key="hibernate.show_sql">true</prop>
      <prop key="hibernate.max_fetch_depth">2</prop>
      <prop key="hibernate.default_batch_fetch_size">8</prop>
      <prop key="hibernate.jdbc.batch_size">20</prop>
      <prop key="hibernate.jdbc.batch_versioned_data">20</prop>
      <prop key="hibernate.generate_statistics">true</prop>
      <prop key="hibernate.jdbc.fetch_size">100</prop>
      <prop key="hibernate.hbm2ddl.auto">update</prop>
    </props>
  </property>
  <property name="eventListeners">
    <map>
      <entry key="post-insert">
        <list>
          <ref bean="ejb3PostInsertEventListener" />
          <ref bean="auditEventListener" />
        </list>
      </entry>
      <entry key="post-update">
        <list>
          <ref bean="ejb3PostUpdateEventListener" />
          <ref bean="auditEventListener" />
        </list>
      </entry>
      <entry key="post-delete">
        <list>
          <ref bean="ejb3PostDeleteEventListener" />
          <ref bean="auditEventListener" />
        </list>
      </entry>
      <entry key="pre-collection-update">
        <ref bean="auditEventListener" />
      </entry>
      <entry key="pre-collection-remove">
        <ref bean="auditEventListener" />
      </entry>
      <entry key="post-collection-recreate">
        <ref bean="auditEventListener" />
      </entry>
    </map>
  </property>   
</bean>

I am using @Transactional annotation in service classes.
Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T13:44:30+00:00Added an answer on May 20, 2026 at 1:44 pm

    Figured it out but could not answer it earlier. Better late then never :-).
    We have to use <tx:annotation-driven> for this.
    Also I think there’s some problem with Spring’s transaction management and saveOrUpdate of Hibernate template. When used together, saveOrUpdate throws nonUniqueKey exception, but merge works fine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a java web app running under Spring 2.5.6, Hibernate 3.4 (with Hibernate
I have working Hibernate/Spring web-app ( HibernateDaoSupport , getHibernateTemplate() , etc). For several tasks
we're working on a web app with Spring, Hibernate/JPA and Maven. We have several
I have a Spring/Hibernate web application (currently working fine on Tomcat) that I am
I'm working on a Java web application (Adobe Flex front-end, JPA/Hibernate/BlazeDS/Spring MVC backend) and
I'm working on a web application with Wicket, Spring and Hibernate and I've come
I'm working on a web application using Spring 3.0 and hibernate 3 with SQL
I am working on a largish Java web application with Spring, Hibernate, and some
The environment of my application: web-based, Spring MVC+Security, Hibernate, MySQL(InnoDB) I am working on
I am building a web app built on Spring MVC and Hibernate. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.