When taking a snapshot of a particular entity, apart from timestamp, user who did the change, etc, I would like to add an additional custom field (ex: comment, which is not described in the entity). Is it possible with Javers when using the auto-audit feature? If yes how can you do it and if no are there any plans of including it?
Asked
Active
Viewed 520 times
1 Answers
2
Yes you can, the properties get added to jv_commit_property table. For example:
Javers javers = JaversBuilder.javers().build();
Map<String, String> params = new HashMap<>();
params.put("comment", "My custom comment");
javers.commit("Some name", myChangedObject, params);

Tom Reay
- 153
- 2
- 9
-
is this supported in auto-audit? ie when annotating CRUD Repositories with @JaversSpringDataAuditable. – patri May 26 '16 at 14:37
-
Looking at the [code for that annotation](https://github.com/javers/javers/tree/master/javers-spring/src/main/java/org/javers/spring/annotation), there doesn't seem to be a way of doing this. In any case it would only allow you to add static params to the commits – Tom Reay May 26 '16 at 21:52
-
https://github.com/javers/javers/issues/375 is done & released in JaVers 2.0.0-RC2 – Bartek Walacik Jun 07 '16 at 18:15