I am using hibernate Envers (version 3.5.6) with JPA and Spring 3. I have below setting in my spring settings (applicationcontext.xml)
<bean id="enversListener" class="org.hibernate.envers.event.AuditEventListener"/> <bean id="mySessionFactory"class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> <property name="dataSource" ref="myDataSource" /> <property name="packagesToScan" value="com.wipro.edo.entities" /> <property name="hibernateProperties"> <value> hibernate.dialect=org.hibernate.dialect.Oracle10gDialect hibernate.connection.pool_size=10 hibernate.temp.use_jdbc_metadata_defaults = false hibernate.show_sql = true hibernate.hbm2ddl.auto = update </value> </property> <property name="eventListeners"> <map> <entry key="post-insert"> <ref local="enversListener"/> </entry> <entry key="post-update"> <ref local="enversListener"/> </entry> <entry key="post-delete"> <ref local="enversListener"/> </entry> <entry key="pre-collection-update"> <ref local="enversListener"/> </entry> <entry key="pre-collection-remove"> <ref local="enversListener"/> </entry> <entry key="post-collection-recreate"> <ref local="enversListener"/> </entry> </map> </property> </bean>
In the logs , I do see org.hibernate.envers.DefaultRevisionEntity getting called. I do not see the AuditEventListener getting initialized, the audit tables are also not getting created inspite of having hibernate.hbm2ddl.auto = update as mentioned above. In terms of the jars , I use :
1.hibernate-core-3.5.6-Final.jar 2.hibernate-entitymanager-3.5.6-Final.jar 3.hibernate-envers-3.5.6-Final.jar 4.hibernate-jpa-2.0-api-1.0.0.Final.jar
When I insert/update any @Audited entity, I do see the audited tables being mentioned as being binded by the hbmbinder : 19.04.2012 20:13:36 *DEBUG* HbmBinder: Mapped property: REVTYPE -> REVTYPE (HbmBinder.java, line 1335) 19.04.2012 20:13:36 *DEBUG* HbmBinder: Mapped property: REVTYPE -> REVTYPE (HbmBinder.java, line 1335) 19.04.2012 20:13:36 *INFO * HbmBinder: Mapping class: com.wipro.edo.entities.EDOPermission_AUD -> tbl_Permission_AUD (HbmBinder.java, line 348) 19.04.2012 20:13:36 *INFO * HbmBinder: Mapping class: com.wipro.edo.entities.EDOPermission_AUD -> tbl_Permission_AUD (HbmBinder.java, line 348)
I do not see the audit tables nor the entries in the database, would be great if anyone can offer a clue.Please do also let me know if more information is needed.
|