Why Hibernate Envers not firing up on update?
I'm using Hibernate Envers to audit log my tables and it is configured using Spring. However when update, modify or delete action is conducted no auditing occurs. Following are the configurations.
Spring configuration
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.bytecode.use_reflection_optimizer">true</prop>
<prop key="hibernate.order_updates">true</prop>
<prop key="hibernate.cache.use_second_level_cache">false</prop>
<prop key="hibernate.query.substitutions">true 'Y', false 'N'</prop>
<prop key="hibernate.connection.SetBigStringTryClob">true</prop>
<prop key="hibernate.jdbc.use_streams_for_binary">true</prop>
<prop key="SetBigStringTryClob">true</prop>
<!--envers config-->
<prop key="org.hibernate.envers.audit_table_suffix">_AUDITING</prop>
<prop key="org.hibernate.envers.revision_field_name">revision_id</prop>
<prop key="org.hibernate.envers.revision_type_field_name">revision_type</prop>
<!--envers listners-->
<prop key="hibernate.ejb.event.post-insert">org.hibernate.ejb.event.EJB3PostInsertEventListener,org.hibernate.envers.event.AuditEventListener</prop>
<prop key="hibernate.ejb.event.post-update">org.hibernate.ejb.event.EJB3PostUpdateEventListener,org.hibernate.envers.event.AuditEventListener</prop>
<prop key="hibernate.ejb.event.post-delete">org.hibernate.ejb.event.EJB3PostDeleteEventListener,org.hibernate.envers.event.AuditEventListener</prop>
<prop key="hibernate.ejb.event.pre-collection-update">org.hibernate.envers.event.AuditEventListener</prop>
<prop key="hibernate.ejb.event.pre-collection-remove">org.hibernate.envers.event.AuditEventListener</prop>
<prop key="hibernate.ejb.event.post-collection-recreate">org.hibernate.envers.event.AuditEventListener</prop>
</props>
</property>
And I have added the @Audited annotation to the entity class. I'm using Hibernate core 3.5.0-Final and same version for envers.
When I check the hibernate logged sqls, I can see the update query has executed but not any query to insert data to audit table. What is wrong here?
将org.springframework.orm.hibernate3.LocalSessionFactoryBean更改为org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean时解决的问题
链接地址: http://www.djcxy.com/p/71562.html