title: Hibernate envers is not working
body: <p>I just want to use hibernate envers in order to audit my entities.I am using envers-1.2.2.ga-hibernate-3.3.jar,hibernate-annotations-3.5.6-Final.jar,hibernate-core-3.5.2-Final.jar and hibernate-jpa-2.0-api-1.0.0.Final.jar.</p>
  
  <p>My entity is below</p>
  
  <p>User.java</p>
  
  <pre><code>@Entity
  @Audited
  
  @Table(name = "ACCT_USER")
  
  @Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
  public class User extends IdEntity {
  
      private String loginName;
      private String password;
      private String name;
      private String email;
      private List&lt;Role&gt; roleList = Lists.newArrayList();
  
  
      @Column(nullable = false, unique = true)
      public String getLoginName() {
          return loginName;
      }
  
      public void setLoginName(String loginName) {
          this.loginName = loginName;
      }
  
      public String getPassword() {
          return password;
      }
  
      public void setPassword(String password) {
          this.password = password;
      }
  
      public String getName() {
          return name;
      }
  
      public void setName(String name) {
          this.name = name;
      }
  
      public String getEmail() {
          return email;
      }
  
      public void setEmail(String email) {
          this.email = email;
      }
  
  
  
  }
  </code></pre>
  
  <p>This is my application context where i have configured envers</p>
  
  <p>applicationContext.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx"
      xmlns:context="http://www.springframework.org/schema/context"
      xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"
      default-lazy-init="true"&gt;
  
      &lt;description&gt;Spring&lt;/description&gt;
  
  
      &lt;bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"&gt;
          &lt;property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" /&gt;
          &lt;property name="ignoreResourceNotFound" value="true" /&gt;
          &lt;property name="locations"&gt;
              &lt;list&gt;
  
                  &lt;value&gt;classpath*:/application.properties&lt;/value&gt;
              &lt;/list&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  
  
      &lt;context:component-scan base-package="net.top" /&gt;
  
  
      &lt;bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"&gt;
          &lt;!-- Connection Info --&gt;
          &lt;property name="driverClassName" value="${jdbc.driver}" /&gt;
          &lt;property name="url" value="${jdbc.url}" /&gt;
          &lt;property name="username" value="${jdbc.username}" /&gt;
          &lt;property name="password" value="${jdbc.password}" /&gt;
  
          &lt;!-- Connection Pooling Info --&gt;
          &lt;property name="maxIdle" value="${dbcp.maxIdle}" /&gt;
          &lt;property name="maxActive" value="${dbcp.maxActive}" /&gt;
          &lt;property name="defaultAutoCommit" value="false" /&gt;
          &lt;property name="timeBetweenEvictionRunsMillis" value="3600000" /&gt;
          &lt;property name="minEvictableIdleTimeMillis" value="3600000" /&gt;
      &lt;/bean&gt;
  
  
  
      &lt;bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"&gt;
          &lt;property name="dataSource" ref="dataSource" /&gt;
          &lt;property name="namingStrategy"&gt;
              &lt;bean class="org.hibernate.cfg.ImprovedNamingStrategy" /&gt;
          &lt;/property&gt;
          &lt;property name="hibernateProperties"&gt;
              &lt;props&gt;
                  &lt;prop key="hibernate.dialect"&gt;${hibernate.dialect}&lt;/prop&gt;
                  &lt;prop key="hibernate.show_sql"&gt;${hibernate.show_sql}&lt;/prop&gt;
                  &lt;prop key="hibernate.format_sql"&gt;${hibernate.format_sql}&lt;/prop&gt;
                  &lt;prop key="hibernate.cache.provider_class"&gt;org.hibernate.cache.EhCacheProvider&lt;/prop&gt;
                  &lt;prop key="hibernate.cache.provider_configuration_file_resource_path"&gt;ehcache/ehcache-hibernate-local.xml&lt;/prop&gt;
              &lt;/props&gt;
          &lt;/property&gt;
          &lt;property name="packagesToScan" value="net.top.*.entity.*" /&gt;
  
      &lt;/bean&gt;
  
  &lt;!-- Envers Info --&gt;
       **&lt;bean id="envers" class="org.hibernate.envers.event.AuditEventListener"&gt;
  
  
         &lt;property name="eventListeners"&gt;
              &lt;map&gt;
                  &lt;entry key="post-insert" value-ref="envers"/&gt;
                  &lt;entry key="post-update" value-ref="envers"/&gt;
                  &lt;entry key="post-delete" value-ref="envers"/&gt;
                      &lt;entry key="post-collection-recreate" value-ref="envers"/&gt;
                  &lt;entry key="pre-collection-remove" value-ref="envers"/&gt;
                  &lt;entry key="pre-collection-update" value-ref="envers"/&gt;
              &lt;/map&gt;
            &lt;/property&gt;
  
            &lt;/bean&gt;**
  
  
      &lt;bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"&gt;
          &lt;property name="sessionFactory" ref="sessionFactory" /&gt;
      &lt;/bean&gt;
  
  
      &lt;tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true" /&gt;
  &lt;/beans&gt;
  </code></pre>
  
  <p>There is no error when am executing the application but there is also no audited tables creating when am adding or removing a user.Is there any other configuration i need to do?.</p>
  
  <p>Update</p>
  
  <p>I got it i just edit my application context like this</p>
  
  <p>applicationContext.xml</p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="UTF-8"?&gt;
      &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx"
          xmlns:context="http://www.springframework.org/schema/context"
          xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"
          default-lazy-init="true"&gt;
  
          &lt;description&gt;Spring&lt;/description&gt;
  
  
          &lt;bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"&gt;
              &lt;property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" /&gt;
              &lt;property name="ignoreResourceNotFound" value="true" /&gt;
              &lt;property name="locations"&gt;
                  &lt;list&gt;
  
                      &lt;value&gt;classpath*:/application.properties&lt;/value&gt;
                  &lt;/list&gt;
              &lt;/property&gt;
          &lt;/bean&gt;
  
  
          &lt;context:component-scan base-package="net.top" /&gt;
  
  
          &lt;bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"&gt;
              &lt;!-- Connection Info --&gt;
              &lt;property name="driverClassName" value="${jdbc.driver}" /&gt;
              &lt;property name="url" value="${jdbc.url}" /&gt;
              &lt;property name="username" value="${jdbc.username}" /&gt;
              &lt;property name="password" value="${jdbc.password}" /&gt;
  
              &lt;!-- Connection Pooling Info --&gt;
              &lt;property name="maxIdle" value="${dbcp.maxIdle}" /&gt;
              &lt;property name="maxActive" value="${dbcp.maxActive}" /&gt;
              &lt;property name="defaultAutoCommit" value="false" /&gt;
              &lt;property name="timeBetweenEvictionRunsMillis" value="3600000" /&gt;
              &lt;property name="minEvictableIdleTimeMillis" value="3600000" /&gt;
          &lt;/bean&gt;
  
  
  
          &lt;bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"&gt;
              &lt;property name="dataSource" ref="dataSource" /&gt;
              &lt;property name="namingStrategy"&gt;
                  &lt;bean class="org.hibernate.cfg.ImprovedNamingStrategy" /&gt;
              &lt;/property&gt;
              &lt;property name="hibernateProperties"&gt;
                  &lt;props&gt;
                      &lt;prop key="hibernate.dialect"&gt;${hibernate.dialect}&lt;/prop&gt;
  &lt;prop key="hibernate.hbm2ddl.auto"&gt;update&lt;/prop&gt;
                      &lt;prop key="hibernate.show_sql"&gt;${hibernate.show_sql}&lt;/prop&gt;
                      &lt;prop key="hibernate.format_sql"&gt;${hibernate.format_sql}&lt;/prop&gt;
                      &lt;prop key="hibernate.cache.provider_class"&gt;org.hibernate.cache.EhCacheProvider&lt;/prop&gt;
                      &lt;prop key="hibernate.cache.provider_configuration_file_resource_path"&gt;ehcache/ehcache-hibernate-local.xml&lt;/prop&gt;
                  &lt;/props&gt;
              &lt;/property&gt;
  &lt;property name="eventListeners"&gt;
                  &lt;map&gt;
                      &lt;entry key="post-insert" value-ref="envers"/&gt;
                      &lt;entry key="post-update" value-ref="envers"/&gt;
                      &lt;entry key="post-delete" value-ref="envers"/&gt;
                          &lt;entry key="post-collection-recreate" value-ref="envers"/&gt;
                      &lt;entry key="pre-collection-remove" value-ref="envers"/&gt;
                      &lt;entry key="pre-collection-update" value-ref="envers"/&gt;
                  &lt;/map&gt;
                &lt;/property&gt;
              &lt;property name="packagesToScan" value="net.top.*.entity.*" /&gt;
  
          &lt;/bean&gt;
  
      &lt;!-- Envers Info --&gt;
          &lt;bean id="envers" class="org.hibernate.envers.event.AuditEventListener"/&gt;
  
  
          &lt;bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"&gt;
              &lt;property name="sessionFactory" ref="sessionFactory" /&gt;
          &lt;/bean&gt;
  
  
          &lt;tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true" /&gt;
      &lt;/beans&gt;
  </code></pre>
  
  <p>thanks for your support</p>