Skip to content
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

ValueObject changes would be reported when quering for entity changes #220

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

ValueObject changes would be reported when quering for entity changes #220

floresek opened this issue Oct 8, 2015 · 5 comments
Assignees
Labels

Comments

@floresek
Copy link

@floresek floresek commented Oct 8, 2015

Hi,

In current version when calling:

javers.findChanges(
                QueryBuilder.byValueObjectId(entityId, entityClass, path)
                        .withNewObjectChanges(true)
                        .build());

ValueObject changes are reported in shallow level:

  • VO reference change
  • VO collection changed
    Unfortunately changes done in VO properties are not reported.

If an entity has got many Value Objects (by references, in collections) to get all changes done on the entity VO properties many additional complex logic and queries have to be done, to resolve Value Objects changes (starting from resolving VO properties, via resolving what happen to them, even resolving current size of collections, to query if VO from collection was changed etc.)

Because of Value Objects nature (there are parts of entity) it would be VERY USEFUL to be able to query form VO changes as following:

javers.findChanges(
                QueryBuilder.byValueObjectId(entityId, entityClass, path)
                        .withNewObjectChanges(true)
                        .withValueObjectChanges(true)
                        .build());

Cheers
Mariusz

@floresek floresek changed the title ValueObject changes could be reported when quering for entity changes ValueObject changes would be reported when quering for entity changes Oct 8, 2015
@bartoszwalacik
Copy link
Member

@bartoszwalacik bartoszwalacik commented Oct 9, 2015

Maybe API should simply looks like that:

javers.findChanges(
                QueryBuilder.byValueObjectId(entityId, entityClass, "*")
                        .build());

and that would give you changes done on all VO embedded in given entity

@palto
Copy link

@palto palto commented Jan 27, 2016

I would seriously like this implemented. I already managed to add javers into my application but had to remove it since I can't use it to generate "last modified" time for a given entity because it has ValueObjects.

@palto
Copy link

@palto palto commented Jan 27, 2016

If anyone else was wrestling with the same problem as me, I figured out that you can detect changes when calling javers.commit(author, entity).getChanges().isEmpty(). This however means that you can't use the auto proxying of repositories feature.

@bartoszwalacik
Copy link
Member

@bartoszwalacik bartoszwalacik commented Jan 28, 2016

OK, I'am moving this issue higher in our backlog

@bartoszwalacik bartoszwalacik self-assigned this Jan 28, 2016
bartoszwalacik added a commit that referenced this issue Jul 6, 2016
mongo impl
bartoszwalacik added a commit that referenced this issue Jul 8, 2016
perf tests for mongo aggregate query
@bartoszwalacik
Copy link
Member

@bartoszwalacik bartoszwalacik commented Jul 28, 2016

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

Successfully merging a pull request may close this issue.

None yet
3 participants