4 Replies Latest reply on Mar 29, 2010 3:37 AM by adamw

    How to show all audit records of child entity using parent entity.

      Scenario :- Let's say there is a parent-child(one-to-many) relationship between entities A and B. I modify one of the elements of B(at rev=115) say B1; then a new record of

      B1 will be created(at rev=116) in B1 audit table and nothing will change in the audit records of A corresponding to rev=116.

       

      Problem :- If i retrieve complete object graph of A(at rev=115) it will not show changes that happened to B1 at rev-116. This is beacuse nothing changed in A at that revision. Is it somehow possible to retrieve B1 records at rev-116 while quering only A so that i can show all revisions of child entities while querying only parent entity? If possible please give the quey.

        • 1. Re: How to show all audit records of child entity using parent entity.
          adamw

          Well if you retrieve A at rev 115 you will get associated B's at rev 115 also. If you retrieve A at rev 116, you will get the modified B's at rev 116. Would you expect anything else?

          • 2. Re: How to show all audit records of child entity using parent entity.
            richa.khurana

            Hi Adam,

             

            Thanks for the response. I am writing on behalf of Amit-

             

            To elaborate the problem a little more. Our requirement is to display all the changes that happened to an entity ever since it was created.

            For eg if we have an entity A with has a one to many mapping with entity B, which in turn further has a one to many mapping with entity C.

            For any changes in entity C, a corresponging row is added to C_AUD table with modification type as MOD and B_AUD table with modification type as INSERT but no row/revision is added to A_AUD table

             

            Now, if I want to know all these changes just by specifiying an object and rev no of A, I cannot look at the changes in entity C. Again, since we need to make a generic framework, we might not be aware of the complete object graph upfront (i.e. We wouldnt know that entity C resides within B and has xyz relationship with A, therefore we cannot use AuditReader to fetch all changes for each relationship of A either.

             

            Kindly suggest.

            • 3. Re: How to show all audit records of child entity using parent entity.
              richa.khurana

              Hi Adam,

               

              We'd greatly appreciate your assistance here. Can you kindly advise?

               

              Thanks,

              Richa

              • 4. Re: How to show all audit records of child entity using parent entity.
                adamw

                Hello,

                 

                I'm afraid this feature isn't yet implemented. To do this, traversing relations in queries would have to be possible, and that's planned for some future version. Right now you can only get the revisions of one entity. It's also non-obvious when relations propagate a "changed" state, e.g. if A has a relation to B, then if A changes, should B be considered changed also? There are many examples where the answer is yes or no, so this has to be user-decided.

                 

                The only thing that I can suggest right now is to force a change in the related entities e.g. by setting a field, but that's a really ugly and non-space-optimal solution.

                 

                Adam