javers

Is it possible to find changes for entities that reference another entity?


I have a Project entity, which is referenced by many other types of entities, for example House and Street. In Javers is it possible to construct a query that would find changes for all entities that belong to a certain project, i.e. reference that project entity?

class Project {
    @Id Long id;
}

class House {
    @Id Long id;
    Project project;
    String name;
}

class Street {
    @Id Long id;
    Project project;
    String name;
}

Solution

  • No, Javers isn't a relational database, there are no joins between Entities. All you can do is to change the mapping, and map House and Street as Value Objects. If so, they would be part of the Project Entity and they would be querable using Project Id.