title: Hibernate Envers with JBoss, Spring and Maven - Doesn't write audit record
body: <p>I am trying to do a Hibernate Envers implementation in conjuction with Spring, JBoss and Maven.</p>
  
  <p>I have the following:</p>
  
  <ul>
  <li>spring.version: 3.1.0.RELEASE</li>
  <li>hibernate.version: 3.5.0-Final</li>
  <li>log4j.version: 1.2.14</li>
  <li>jboss-as-7.1.1.Final</li>
  <li>mysql DB</li>
  </ul>
  
  <p>In the pom.xml I have added the required hibernate-envers:</p>
  
  <pre><code>    &lt;dependency&gt;    
          &lt;groupId&gt;org.hibernate&lt;/groupId&gt;    
          &lt;artifactId&gt;hibernate-envers&lt;/artifactId&gt;    
          &lt;version&gt;${hibernate.version}&lt;/version&gt;
      &lt;/dependency&gt;
  </code></pre>
  
  <p>In my Hibernate persistance class, I am importing the following</p>
  
  <pre><code>import org.hibernate.envers.Audited;
  </code></pre>
  
  <p>So it looks like </p>
  
  <pre><code>@Entity
  @Indexed
  @Audited 
  @Table(name = "COM_TEST")
  public class MyTest extends AbstractReferenceDataObject { ...
  </code></pre>
  
  <p>I have ensured that there is a COM_TEST_AUD db table with the relevant DB columns as well as a REVINFO db table.</p>
  
  <p>When I run my code, it uses the existing hibernate implementation to update a record in COM_TEST. But nothing is written to the COM_TEST_AUD or REVINFO db tables. </p>
  
  <p>I have the following properties in my persistence.xml</p>
  
  <pre><code>    &lt;properties&gt;
          &lt;property name="hibernate.dialect" value="org.hibernate.dialect.MySQLInnoDBDialect"/&gt;
          &lt;property name="hibernate.connection.autocommit" value="true" /&gt;
          &lt;property name="hibernate.hbm2ddl.auto" value="validate"/&gt;
          &lt;property name="hibernate.show_sql" value="false"/&gt;
          &lt;property name="hibernate.cache.use_second_level_cache" value="true"/&gt;
          &lt;property name="hibernate.cache.provider_class" value="net.sf.ehcache.hibernate.SingletonEhCacheProvider"/&gt;
          &lt;property name="hibernate.search.default.directory_provider" value="org.hibernate.search.store.FSDirectoryProvider"/&gt;
          &lt;property name="hibernate.search.default.indexBase" value="./lucene/indexes"/&gt;
          &lt;property name="hibernate.search.default.batch.merge_factor" value="10"/&gt;
          &lt;property name="hibernate.search.default.batch.max_buffered_docs" value="10"/&gt;
      &lt;/properties&gt;
  </code></pre>
  
  <p>I have tried just about everything I can think of. I can see when I start JBoss, it does say how it needs and fines the COM_TEST_AUD and REVINFO, so looks like that works. </p>
  
  <p>I just can't work out why it wont write to the DB. There is nothing written to the log file and I have the logging set to:</p>
  
  <pre><code>        &lt;logger category="org.hibernate"&gt;
              &lt;level name="DEBUG"/&gt;
          &lt;/logger&gt;
  </code></pre>
  
  <p>I have noticed that in the JBoss modules directory below it uses hibernate-envers-4.0.1.Final.jar: </p>
  
  <pre><code>jboss-as-7.1.1.Final\modules\org\hibernate\envers\main
  </code></pre>
  
  <p>I have changed my project pom.xml to be 4.0.1.Final instead of 3.5.0-Final, but it didn't make a difference</p>
  
  <p>Can someone please help?</p>