Javers not catching change when a field is changed for an item in a list

15 Views Asked by At

I have a list of employees. When any item inside this list is edited and any field is changed for that item then javers is not detecting the change.

class Company {
String companyName;
List<employee> employees;
...
}

class employee {
String name;
int age;
}

I'm trying to build by jqlQuery in the following way -

jqlQuery = QueryBuilder.byInstanceId(id, Company.class)
    .withShadowScope(ShadowScope.DEEP_PLUS)
    .withChangedPropertyIn(Arrays.stream(fields).map(Field::getName).toArray(String[]::new))
    .build();
List<Shadow> shadows = javers.findShadows(jqlQuery);

where, fields is an array which contains elements for which I want to capture change. (This includes the List employees)

What should be modified so that if I change the age of suppose any one employee inside the list of employees, then javers can catch this change?

I tried changing the shadow scope to build the jql query so that a change in any list element is also caught by javers but it didn't seem to work

0

There are 0 best solutions below