I'm trying to use Envers to check for updates / inserts in my table. I created a table with the extension audit _AUDIT in the database.
But when I actually run the app, I do not see any records in the audit tables. I do not even errors or exceptions. Entries are inserted in the main table, but AUDIT table are not updated.
Here is my configuration ENVERS:
hibernate.cfg.xml:
<property name="org.hibernate.envers.audit_table_suffix">_AUDIT</property> <property name="org.hibernate.envers.revision_field_name">REVISION_ID</property> <property name="org.hibernate.envers.revision_type_field_name">REVTYPE</property> <property name="org.hibernate.envers.do_not_audit_optimistic_locking_field">true</property> <property name="org.hibernate.envers.default_schema">ROCC</property> <listener class="org.hibernate.envers.event.AuditEventListener" type="post-insert"/> <listener class="org.hibernate.envers.event.AuditEventListener" type="post-update"/> <listener class="org.hibernate.envers.event.AuditEventListener" type="post-delete"/> <listener class="org.hibernate.envers.event.AuditEventListener" type="pre-collection-update"/> <listener class="org.hibernate.envers.event.AuditEventListener" type="pre-collection-remove"/> <listener class="org.hibernate.envers.event.AuditEventListener" type="post-collection-recreate"/>
My table is as follows:
@Audited @Entity @Table(name = "TRANSACTION", schema = "ROCC") public class TransactionTable implements java.io.Serializable{...} schema = "ROCC") @Audited @Entity @Table(name = "TRANSACTION", schema = "ROCC") public class TransactionTable implements java.io.Serializable{...}
The audit table is TRANSACTION_AUDIT in the same schema.
Can anyone tell me why the audit is not working?
source share