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
JaVers runtime error - diff for Set of ValueObjects is not supported #191
Comments
well, first, JaVers doesn't know anything about Jackson and its annotations The error you see - 'diff for Set of ValueObjects is not supported' means that you cannot manage Sets of ValueObject in Javers. |
Hi Barto, |
@lathy88, reopen this ticket if our documentation won't help you |
Why is diff for sets in value objects not supported ? |
was just wondering the same thing, entities with sets of value objects should be a pretty common use-case? |
The reason why JaVers doesn't support diff for Sets of ValueObjects is simple, we have no good idea how to do this :) Imagine that you have two sets with ValueObjects. |
heh, I see your point, alterations would per definition be impossible to track. Best you could do is consider the set itself a value object, and detect if it had changed (objects added/removed), would be useful in my use-case at least. Maybe as a SetChange? |
true, new algorithm could detect only added/removed object. Digest heuristic is not obvious, we could try simply stringify and join all properties. But many Classes dont have good value-based toString()... |
Hm, I'd have thought you might just use object.equals, and delegate all the problems to the individual developers? We won't be able to track individual property changes, but since a changed value object is per definition a new value object that sort of makes sense? |
or that might be a bad idea, since the rest of Javers doesn't require you to implement equals... so stringify and join might be better... |
Thats because many devs dont provide good equals() so we should not rely on it. We have |
Will you consider opening a issue for this? |
new Issue can be created easily, the problem is we don't have manpower to develop this ... |
failing tests and OwnerContext refactoring
fixed in release 1.6.0 |
Hi @bartoszwalacik, could you please give a gist of the changes you made in this fix? Please suggest. Here is my test case:
I'm using sysCode and localId as a combined identifier for the object, not including the goldenId.
//getters, setters.
} Diff:
|
@ndsurendra please do not comment on closed issues, if you have a question, ask at https://stackoverflow.com/questions/tagged/javers |
Recently i got this error,
can not handle managed/back reference 'defaultreference' in jackson for composite key
I googled alot but found the below option to use,
JsonManagedReference and JsonBackReference
Reference-> http://wiki.fasterxml.com/JacksonFeatureBiDirReferences
But my situation is,
Class Parent{
private int id;
@JsonManagedReference
Set childSet;
}
Class Child{
private ChildId childId;
private String name;
}
Class ChildId{
private int childKey;
@JsonBackReference
private Parent parent;
}
As you see, in the child class it has a composite key. I can not change this since it has relationship with DB.
Can anybody help me with this issue?
Note:
I'm using Jackson 2.4.3
I'm using Javers 1.2.9 for Object comparison
Update:
I removed all the JsonManaged and JsonBackReference annotations and added only JsonIgonre in Child as below,
Class ChildId{
private int childKey;
@JsonIgnore
private Parent parent;
}
After doing this I got the below error,
11:39:59,712 ERROR SetChangeAppender:46 - could not diff Field Set Child1; //declared in: Parent, JaVers runtime error - diff for Set of ValueObjects is not supported
The text was updated successfully, but these errors were encountered: