I am trying to do a Hibernate Envers implementation in conjuction with Spring, JBoss and Maven.
I have the following:
- spring.version: 3.1.0.RELEASE
- hibernate.version: 3.5.0-Final
- log4j.version: 1.2.14
- jboss-as-7.1.1.Final
- mysql DB
In the pom.xml I have added the required hibernate-envers:
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-envers</artifactId>
<version>${hibernate.version}</version>
</dependency>
In my Hibernate persistance class, I am importing the following
import org.hibernate.envers.Audited;
So it looks like
@Entity
@Indexed
@Audited
@Table(name = "COM_TEST")
public class MyTest extends AbstractReferenceDataObject { ...
I have ensured that there is a COM_TEST_AUD db table with the relevant DB columns as well as a REVINFO db table.
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.
I have the following properties in my persistence.xml
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLInnoDBDialect"/>
<property name="hibernate.connection.autocommit" value="true" />
<property name="hibernate.hbm2ddl.auto" value="validate"/>
<property name="hibernate.show_sql" value="false"/>
<property name="hibernate.cache.use_second_level_cache" value="true"/>
<property name="hibernate.cache.provider_class" value="net.sf.ehcache.hibernate.SingletonEhCacheProvider"/>
<property name="hibernate.search.default.directory_provider" value="org.hibernate.search.store.FSDirectoryProvider"/>
<property name="hibernate.search.default.indexBase" value="./lucene/indexes"/>
<property name="hibernate.search.default.batch.merge_factor" value="10"/>
<property name="hibernate.search.default.batch.max_buffered_docs" value="10"/>
</properties>
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.
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:
<logger category="org.hibernate">
<level name="DEBUG"/>
</logger>
I have noticed that in the JBoss modules directory below it uses hibernate-envers-4.0.1.Final.jar:
jboss-as-7.1.1.Final\modules\org\hibernate\envers\main
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
Can someone please help?