0 Replies Latest reply on Mar 27, 2014 6:09 AM by varun14

    How to audit master & details table information.

    varun14

      Hi,

       

           I am using hibernate 4.1.9 final.I have two tables master and details table.Primary key of master table is foreign key to details table.

      When I add record to master and details the audit entry is made for both master and details.But when I delete a record from the master table,i.e. at server side I have first removed the details and then master after some validations.

         After deletion the master audit table gets delete entry but the details table does not.I am not getting what is wrong.

         Following are the entries in my hibernate.cfg.xml,

       

               <property name="hibernate.ejb.event.post-insert">org.hibernate.ejb.event.EJB3PostInsertEventListener,org.hibernate.envers.event.AuditEventListener</property>

             <property name="hibernate.ejb.event.post-update">org.hibernate.ejb.event.EJB3PostUpdateEventListener,org.hibernate.envers.event.AuditEventListener</property>

             <property name="hibernate.ejb.event.post-delete">org.hibernate.ejb.event.EJB3PostDeleteEventListener,org.hibernate.envers.event.AuditEventListener</property>

             <property name="hibernate.ejb.event.pre-collection-update">org.hibernate.envers.event.AuditEventListener</property>

             <property name="hibernate.ejb.event.pre-collection-remove" >org.hibernate.envers.event.AuditEventListener</property>

             <property name="hibernate.ejb.event.post-collection-recreate" >org.hibernate.envers.event.AuditEventListener</property>

               <property name="hibernate.ejb.event.post-collection-recreate" >org.hibernate.envers.event.AuditEventListener</property>

       

      And both the master and details models are annoted like,

      @Entity

      @Audited

      public class MasterModel

       

       

       

      @Entity

      @Audited

      public class DetailsModel

      {

      //....

      }