-
1. Re: Envers with Hibernate Sessions and Spring
minajagi Oct 31, 2011 10:51 AM (in response to minajagi)A little more details.I changed my spring configuration to add the required listeners (corressponding to setEventListeners) on the
org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean.
Read on the internet that the listeners have to go under listeners property and not hibernateProperties.
Now while debugging I find that AuditListener code gets invoked but there are no rows being created.I'm using hbm.dd.auto="update" so I see the tables created too but witout any rows and without any exceptions.
Can someone point me in the right direction.
Regards,
Chetan
-
2. Re: Envers with Hibernate Sessions and Spring
adamw Oct 31, 2011 11:00 AM (in response to minajagi)It must be something with the transactions configuration. Are you using MySQL? If so, do you have autocommit off and are you using InnoDB?
Adam
-
3. Re: Envers with Hibernate Sessions and Spring
minajagi Oct 31, 2011 11:51 AM (in response to adamw)Thanks for the quick reply.We use Oracle.
By the way I even went into the config and since we use org.apache.commons.dbcp.BasicDataSource i specifically added the defaultAutoCommit=false
<bean id="referenceDataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close" lazy-init="true">
<property name="driverClassName" value="oracle.jdbc.OracleDriver" />
<property name="url" value="${dealworks.dw.database.url}" />
<property name="username" value="${dealworks.dw.database.user}" />
<property name="password" value="${dealworks.dw.database.password}" />
<property name="defaultAutoCommit" value="false"/>
</bean>
I still don't see the audit happening.
Also can you point me to the exact place/line where the actual insert happens for the audit records.
Regards,
Chetan
-
4. Re: Envers with Hibernate Sessions and Spring
adamw Nov 8, 2011 5:51 AM (in response to minajagi)Not sure which version you are using but can you try debugging AuditProcess.doBeforeTransactionCompletion/AuditSynchronization to see if the method is called and if the work units, which should write the audit, are executed.
Adam
-
5. Re: Envers with Hibernate Sessions and Spring
minajagi Nov 8, 2011 5:38 PM (in response to adamw)Sure.will let you know.For now,after struggling to make Envers work with our existing code I finally ended up using spring transactions and it started to work.The hibernate callback that was being used had to be changed.
I will try and report my findings based on your above suggestion shortly though.
Regards,
Chetan