1 2 Previous Next 15 Replies Latest reply on Feb 3, 2014 7:11 AM by sandhya rani

    Auditing collection not working

    Nick . Apprentice

      Hi,

            I have two entity as follows

       

      Class A


      public class A {

       

           private Set<B> children = new HashSet<B>();

           @AuditMappedBy("parent")

          public Set<B> getChildren() {

                return this.children;

           }

           ..

      }

       

      public class B {

       

           private A parent;

            private Date fromDate;

       

          public A getParent() {

                return this.parent;

           }

           @Audited

           public getFromDate() {

                return this.fromDate;

           }

           ...

      }

       

       

      A.hbm.xml

       

      <hibernate-mapping>

                <class name="A" table="TBL_A">

         ......

      <set name="children " table="TBL_B" inverse="true" access="field" cascade="all-delete-orphan">

                                            <key>

                                                        <column name="ID_A" />

                                   </key>

                <one-to-many class="B" />

      </set>

      ......

       

      B.hbm.xml

       

      <hibernate-mapping>

        <class name="B" table="TBL_B">

         ......

      <many-to-one name="parent" class="A"  cascade="save-update" column="ID_A">

        ......

       

      Now the problem is

       

      A_AUD table does not generating a relationship with B_AUD and vice versa B_AUD doesn't have any relationship with A_AUD, In this case we wont get the child object changes from parent entity.

       

      Can anyone please help me to solve this issue, do i have to do anything else apart from @AuditMappedBy() ?

        1 2 Previous Next