-
1. Re: Auditing collection not working
nick.sree Apr 18, 2013 3:11 AM (in response to nick.sree)Can anyone help me on this, does this work with entity annoated with envers and mapped using hbm file?
-
2. Re: Auditing collection not working
adamw Apr 23, 2013 10:04 AM (in response to nick.sree)You don't seem to have @Audited annotations on the collection fields?
Adam
-
3. Re: Auditing collection not working
nick.sree Apr 23, 2013 4:35 PM (in response to adamw)Hi Adam,
No, i have @AuditMappedBy at getter method. (Even i have tried with @Audit insteadof @AuditMappedBy as well)
@AuditMappedBy("parent")
public Set<B> getChildren() {
return this.children;
}
Infact i have put the envers annoation at getters only (Table is not getting created when i put envers annotation at field level).
-
4. Re: Auditing collection not working
adamw Apr 24, 2013 10:44 AM (in response to nick.sree)You need both @Audited and @AuditedMappedBy. @AMB is only an addition.
Adam
-
5. Re: Auditing collection not working
nick.sree Apr 25, 2013 5:20 AM (in response to adamw)Hi Adam,
I have added both annoation as below but no luck, its not creating any relationship between table A and B
@Audited
@AuditMappedBy("parent")
public Set<B> getChildren() {
return this.children;
}
This is happing only for one-to-many relationship.
FYI : i'm using envers-1.2.2.ga-hibernate-3.3 in hibernate-3.3.1.GA
-
6. Re: Auditing collection not working
adamw Apr 29, 2013 11:50 AM (in response to nick.sree)What about the other side of the collection, does "parent" have @Audited as well?
Adam
-
7. Re: Auditing collection not working
nick.sree May 1, 2013 12:57 AM (in response to adamw)Hi Adam,
No i haven't add the annotation at there, since i just want to annote a field in that enity B. Will check what ever you have mentionedand and update you.
-
8. Re: Auditing collection not working
nick.sree May 1, 2013 4:08 AM (in response to adamw)Hi Adam,
I have put @audited entity at other side of the collection as well. Now B_AUD table is has added with one more column for parent_id but still there is no relationship established between A_AUD and B_AUD tables. Please let me know what else i have to do,if required i can sent you the full example code for the same issue.
-
9. Re: Auditing collection not working
adamw May 23, 2013 11:44 AM (in response to nick.sree)Hmm I don't know, it should work. What do you mean by "no relationship established"? What are the annotations now and the content of the _AUD tables?
Adam
-
10. Re: Auditing collection not working
nick.sree May 31, 2013 6:20 AM (in response to adamw)What i mean by relationship is, If i add or delet a child from parent its not changing any rev no in parent_aud table.
Now my annoated class is like
public class A {
private Set<B> children = new HashSet<B>();
@Audited
@AuditMappedBy("parent")
public Set<B> getChildren() {
return this.children;
}
..
}
public class B {
private A parent;
private Date fromDate;
@Audited
public A getParent() {
return this.parent;
}
@Audited
public getFromDate() {
return this.fromDate;
}
...
}
Pseudo Table data
Parent
RevNo Id RevType 1 1 0 Child
RevNo id RevType 1 1 0 2 1 1 This Data is the outcome of
1) Inserting a parent with one child
2) Editing the parent's child (changing only the child data).
-
11. Re: Auditing collection not working
adamw Jun 6, 2013 8:50 AM (in response to nick.sree)Well if you change the parent's child (only the child data), then the parent is not modified - that is correct behavior.
The parent should only have a new reivsion if new children are added or old ones removed - is that what you are seeing?
Adam
-
12. Re: Auditing collection not working
nick.sree Jun 12, 2013 12:09 PM (in response to adamw)Ok, In that case how we will traverse from parent to child audit history?
-
13. Re: Auditing collection not working
adamw Jun 17, 2013 10:10 AM (in response to nick.sree)I don't understand - you can get the parent object at the revision when the child was modified and traverse as every other object
Adam
-
14. Re: Auditing collection not working
nick.sree Aug 12, 2013 10:53 PM (in response to adamw)If i want to generate an audit report for the parent including audit history of child object, how can i do it in this case? can you please give some idea about the code.