Skip to content

How to get nested ValuObjects changes #216

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
floresek opened this issue Oct 1, 2015 · 5 comments
Closed

How to get nested ValuObjects changes #216

floresek opened this issue Oct 1, 2015 · 5 comments

Comments

@floresek
Copy link

floresek commented Oct 1, 2015

Hi,

I have classes:

class Master {
    @Id
    String id;

    Detail detail;

    public Master(String id) {
        this.id = id;
    }
}

@ValueObject
class Detail {
    String data;
    Detail subdetail;

    public Detail(String data) {
        this.data = data;
    }
}

and test code:

        Master master = new Master("1");
        master.detail = new Detail("detail-1");
        master.detail.subdetail = new Detail("subdetail-1.1");
        master.detail.subdetail.subdetail = new Detail("subdetail-1.1.1");
        javers.commit("anonymous", master);

I know how to read first level ValueObject changes:

        List<Change> changes = javers
                .findChanges(QueryBuilder.byValueObjectId("1", Master.class, "detail")
                        .withNewObjectChanges(true)
                        .build());

but how to read second, third, ... - any level VO changes/snapshots?

f.e.

        List<Change> changes = javers
                .findChanges(QueryBuilder.byValueObjectId("1", Master.class, "detail/subdetail")
                        .withNewObjectChanges(true)
                        .build());
@bartoszwalacik
Copy link
Member

well, nested ValueObjects dont have a goood support yet :(

@bartoszwalacik
Copy link
Member

related to #220

bartoszwalacik added a commit that referenced this issue Apr 13, 2016
basic support for querying nested VO changes
@bartoszwalacik
Copy link
Member

example query

      def changes = javers.findChanges(QueryBuilder.byValueObjectId(1, DummyUserDetails,
              "dummyAddress/networkAddress").build())

@bartoszwalacik
Copy link
Member

fixes merged to master, waiting for release

@bartoszwalacik
Copy link
Member

released in 1.6.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants