1 Reply Latest reply on Feb 29, 2016 5:13 AM by immutable

    Envers not write in my property Object audit table

    immutable

      Hello every one Im new in java dev world and now I have work with Envers. I need to get auditeds for some entity and show history of changes of it. But I have one problem now if some one help me I will be very very happy.

       

      So this is my problem

       

      public class PenaltyProtocol implements Serializable {

       

          private int version;

       

          private static final long serialVersionUID = -4664181510953690387L;

       

          private int id = -1;

          private PenaltyVehicle penaltyVehicle = null;

          private Employee driver = null;

          private Employee operator = null;

          private Employee polliceOfficer = null;
      }

       

      and My Employee class looks like this:

       

      @Audited

      public class Employee implements Serializable{

       

          private static final long serialVersionUID = 6759169667298660750L;

       

          private int id = -1;

          private Position position = null;

          private String fullName = null;

          private String isValid = null;

          }

       

      I have table for PenaltyProtocol and when I change it and save it the changes are afected in my PenaltyProtocolAuditTable but when I change Employee and save PenaltyProtocol the changes are saved in PenaltyProtocolTable but they do not saved in EmployeeAuditTable???
      Can some one help me with this problem. What is wrong?

       

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

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

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

                         

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

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

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

                         

                      <prop key="org.hibernate.envers.default_schema">audit</prop>

                      <prop key="org.hibernate.envers.audit_table_prefix">v_</prop>

                      <prop key="org.hibernate.envers.audit_table_suffix"></prop>

                      <prop key="org.hibernate.envers.revision_field_name">rev</prop>

                      <!-- <prop key = "hibernate.hbm2ddl.auto">create</prop> --> <!-- auto create table if do not exist -->

                      <!-- <prop key="org.hibernate.envers.global_with_modified_flag">true</prop> -->

       

      This is my envers settings in my database.xml