Let’s start with an example of my data:
{
'id': 'foo',
'name': 'Me',
'friends': [
{
'id': 0,
'name': 'Mark'
'location': 'here'
},
...
],
'family': [
{
'id': 1,
'name': 'Mom',
'location': 'there'
},
{
'id': 0,
'name': 'Mark'
'location': 'here'
},
.....
]
}
Let’s say this is using a basic class such as:
@Entity
public class Person {
@Id
Integer id;
String name;
String location;
List<Person> friends;
List<Person> family;
}
In this fictious example I have a root object (id=foo) and two lists of friends
and family
. The two lists contain the same type (let’s say Person
), and they are both @Entity
types with their own IDs. Let’s say I consider Mark to be adopted family, he’s both in friends
and family
.
Now, if Mark changes his location from 'here'
to 'there'
, I’d like Javers to tell me that it changed in both lists friends
and family
. Currently though when I use javers.compare(existing, updated);
, it seems I would get a set of changes that tells me something like this:
Diff@33 "Diff:
* changes on Person/0 :
- 'location' changed: 'here' -> 'there'
* changes on Person/0 :
- 'location' changed: 'here' -> 'there'
What I don’t get here is information that Person 0 was in both the friends
list and the family
list on Person/foo. Is it possible to get this information out of a Javers Diff.