title: AuditException: Unable to create revision because of non-active transaction
body: <p>I have been updating the frameworks on my application and now I'm trying to configure hibernate envers with JPA to audit some domains.</p>
  
  <p>Regular persistence is working properly by Audit is failing with the error below</p>
  
  <p>I've got this error</p>
  
  <pre><code>org.springframework.orm.hibernate4.HibernateSystemException: Unable to create revision because of non-active transaction; nested exception is org.hibernate.envers.exception.AuditException: Unable to create revision because of non-active transaction
      at org.springframework.orm.hibernate4.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:218)
      at org.springframework.orm.hibernate4.SpringSessionSynchronization.beforeCommit(SpringSessionSynchronization.java:107)
      ....
  </code></pre>
  
  <p>My configuration is:</p>
  
  <pre><code>  &lt;!--  How to include more then one base package --&gt;
    &lt;!--Activates various annotations to be detected in bean classes: Spring's @Required and @Autowired and so on--&gt;
    &lt;context:annotation-config/&gt;
    &lt;!--Scanning components in base-package (look for annotations) --&gt;
    &lt;context:component-scan base-package="com.lotjm"/&gt;
    &lt;context:property-placeholder location="classpath:./properties/database.properties"/&gt;
  
    &lt;bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"&gt;
      &lt;property name="jpaDialect"&gt;
        &lt;bean class="org.springframework.orm.jpa.vendor.HibernateJpaDialect" /&gt;
      &lt;/property&gt;
    &lt;/bean&gt;
  
    &lt;bean id="entityManagerFactory"
          class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"&gt;
      &lt;property name="packagesToScan" value="com.lotjm"/&gt;
      &lt;property name="dataSource" ref="dataSource"/&gt;
  
      &lt;property name="jpaVendorAdapter"&gt;
        &lt;bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"&gt;
          &lt;property name="generateDdl" value="false"/&gt;
          &lt;property name="showSql" value="true" /&gt;
        &lt;/bean&gt;
      &lt;/property&gt;
      &lt;property name="jpaPropertyMap"&gt;
        &lt;props&gt;
          &lt;prop key="hibernate.show_sql"&gt;true&lt;/prop&gt;
          &lt;prop key="hibernate.dialect"&gt;org.hibernate.dialect.MySQLDialect&lt;/prop&gt;
          &lt;prop key="hibernate.hbm2ddl.auto"&gt;update&lt;/prop&gt;
          &lt;prop key="hibernate.ejb.naming_strategy"&gt;org.hibernate.cfg.ImprovedNamingStrategy&lt;/prop&gt;
          &lt;prop key="org.hibernate.envers.audit_strategy_validity_store_revend_timestamp"&gt;true&lt;/prop&gt;
        &lt;/props&gt;
      &lt;/property&gt;
  
      &lt;property name="persistenceProvider"&gt;
        &lt;bean class="org.hibernate.jpa.HibernatePersistenceProvider"&gt;&lt;/bean&gt;
      &lt;/property&gt;
  
    &lt;/bean&gt;
  
    &lt;!-- Need for Repository abstraction --&gt;
    &lt;jpa:repositories base-package="com.lotjm.repository"
                      factory-class="org.springframework.data.envers.repository.support.EnversRevisionRepositoryFactoryBean"/&gt;
  
    &lt;tx:annotation-driven transaction-manager="transactionManager" order="1"/&gt;
  
    &lt;bean id="hibernateTransactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager"&gt;
          &lt;property name="sessionFactory" ref="sessionFactory"&gt;&lt;/property&gt;
    &lt;/bean&gt;
  
    &lt;bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"&gt;
      &lt;property name="driverClassName" value="${jdbc.driverClassName}"/&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;/bean&gt;
  
    &lt;bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"&gt;
      &lt;property name="dataSource"&gt;
        &lt;ref bean="dataSource"/&gt;
      &lt;/property&gt;
      &lt;property name="hibernateProperties"&gt;
        &lt;props&gt;
          &lt;prop key="hibernate.dialect"&gt;org.hibernate.dialect.MySQLDialect&lt;/prop&gt;
          &lt;prop key="hibernate.show_sql"&gt;true&lt;/prop&gt;
          &lt;prop key="hibernate.hbm2ddl.auto"&gt;validate&lt;/prop&gt;
        &lt;/props&gt;
      &lt;/property&gt;
  
      &lt;property name="annotatedClasses"&gt;
        &lt;list&gt;
          &lt;value&gt;com.lotjm.domain.User&lt;/value&gt;
          &lt;value&gt;com.lotjm.domain.Application&lt;/value&gt;
          &lt;value&gt;com.lotjm.domain.Project&lt;/value&gt;
          &lt;value&gt;com.lotjm.domain.Document&lt;/value&gt;
          &lt;value&gt;com.lotjm.domain.AbstractAuditingEntity&lt;/value&gt;
        &lt;/list&gt;
      &lt;/property&gt;
      &lt;property name="namingStrategy"&gt;
              &lt;bean class="org.hibernate.cfg.ImprovedNamingStrategy" /&gt;
      &lt;/property&gt;
    &lt;/bean&gt;
  
    &lt;bean id="auditingProvider" class="com.lotjm.config.audit.UsernameAuditorAware"/&gt;
  
    &lt;bean id="dateTimeService" class="com.lotjm.config.audit.CurrentTimeDateTimeService"/&gt;
  
    &lt;bean id="dateTimeProvider" class="com.lotjm.config.audit.AuditingDateTimeProvider"&gt;
      &lt;constructor-arg index="0" ref="dateTimeService"/&gt;
    &lt;/bean&gt;
  
    &lt;jpa:auditing auditor-aware-ref="auditingProvider" set-dates="true" date-time-provider-ref="dateTimeProvider"/&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>Any suggestion on how to fix it?</p>
  
  <p>Tks</p>