Я работаю над веб-приложением Spring и Hibernate. Я должен использовать Envers для аудита.
Но когда я запускаю приложение, создаются только таблицы аудита, но в таблицы аудита данные не вставляются.
Файл конфигурации:
<mvc:annotation-driven/>
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<bean name="callbackHandler" class="org.hibernate.ejb.event.EntityCallbackHandler" />
<bean name="auditEventListener" class="org.hibernate.envers.event.AuditEventListener" />
<bean name="ejb3PostInsertEventListener" class="org.hibernate.ejb.event.EJB3PostInsertEventListener">
<property name="callbackHandler"><ref bean="callbackHandler"/></property>
</bean>
<bean name="ejb3PostUpdateEventListener" class="org.hibernate.ejb.event.EJB3PostUpdateEventListener">
<property name="callbackHandler">
<ref bean="callbackHandler" />
</property>
</bean>
<bean name="ejb3PostDeleteEventListener" class="org.hibernate.ejb.event.EJB3PostDeleteEventListener">
<property name="callbackHandler">
<ref bean="callbackHandler" />
</property>
</bean>
<bean id="sessionFactory" name="sessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"
lazy-init="false">
<property name="dataSource" ref="dataSource" />
<property name="annotatedClasses">
<list>
<value>foo.bar.Person</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.max_fetch_depth">2</prop>
<prop key="hibernate.default_batch_fetch_size">8</prop>
<prop key="hibernate.jdbc.batch_size">20</prop>
<prop key="hibernate.jdbc.batch_versioned_data">20</prop>
<prop key="hibernate.generate_statistics">true</prop>
<prop key="hibernate.jdbc.fetch_size">100</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
</props>
</property>
<property name="eventListeners">
<map>
<entry key="post-insert">
<list>
<ref bean="ejb3PostInsertEventListener" />
<ref bean="auditEventListener" />
</list>
</entry>
<entry key="post-update">
<list>
<ref bean="ejb3PostUpdateEventListener" />
<ref bean="auditEventListener" />
</list>
</entry>
<entry key="post-delete">
<list>
<ref bean="ejb3PostDeleteEventListener" />
<ref bean="auditEventListener" />
</list>
</entry>
<entry key="pre-collection-update">
<ref bean="auditEventListener" />
</entry>
<entry key="pre-collection-remove">
<ref bean="auditEventListener" />
</entry>
<entry key="post-collection-recreate">
<ref bean="auditEventListener" />
</entry>
</map>
</property>
</bean>
Я использую аннотацию @Transactional
в классах обслуживания.
Заранее спасибо.