This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes Envers configuration with hibernate.cfg.xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Envers configuration with hibernate.cfg.xml" Watch "Envers configuration with hibernate.cfg.xml" New topic

Envers configuration with hibernate.cfg.xml

Sri Harsha Yenuganti

Joined: Mar 02, 2010
Posts: 18
I am trying to use Envers to audit the updates/inserts into my tables. I have created audit tables with extension _AUDIT in the DB.

But when I actually run the application, I dont see any entries in the audit tables. I even have no errors or exceptions thrown. Entries are being inserted into the main tables but the AUDIT tables are not updated.

Here is my ENVERS configuration :


<!-- Hibernate ENVERS Configuration -->
<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>

<!-- Hibernate ENVERS Listener Configuration -->

<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:

* Transaction generated by hbm2java
@Table(name = "TRANSACTION", schema = "ROCC")
public class TransactionTable implements{...}

The Audit table is TRANSACTION_AUDIT in the same schema.

Can any one tell me why the auditing is not working?
I agree. Here's the link:
subject: Envers configuration with hibernate.cfg.xml
It's not a secret anymore!