1 Reply Latest reply on Aug 29, 2011 7:46 AM by adamw

    Revisionnr of update is not saved in owning audit table of a 1:n relationship

    ste8701

      Hi everybody,

       

      i have one problem with the audit entries generated by envers for a simple unidirectional 1-n relationship(e.g. A to B).

      the owning side(A) holds a list of Bs which is annotated as follow [code]@OneToMany(cascade={CascadeType.ALL})[/code]Both A and B are audited on class level with @Audited.

       

      [u]Context:[/u]

      - when i persist B-objects by adding them to the list in A(e.g. A.getB().add(newB)) then commit, the revisionnr(1) is saved for all added Bs in B_AUD and also one entry in A_AUD for this transaction.

      - same behavior occurs when i remove B-objects from the list in A(e.g. A.getB().remove(oldB)) => revision(2)

       

      So far good.

       

      [u]Problem:[/u]

      envers doesnt insert the revisionnr of the updates made to B-objects of the A-list when i do smthg like this:

      [code]B toMod = A.getB().get(1);

      toMod.mod();

      [/code]

      Then i commit the changes after its done. the new revisionnr(3) is present in B_AUD for all modified objects, but not in A_AUD. it seems like A isnt aware of the changes being made.

       

      is this supported by envers at all? if yes, what im doing wrong? i really want to have just this one entry in A_AUD with the resivionnr of the update( and not 1 different revision in A_AUD for every change made in B. e.g if i modify 5 B-objects of the A-List, then there will be 5 different revisions in A_AUD for each change 1,2,3,4,5)

       

      i hope my issue is comprehensible..every help will be appreciated.

      TIA