-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Final implementation specific collection is overridden on deserialization #966
Comments
There is no functionality currently to do sort of merge with possibly existing Collection/Map valued property, although there are plans/hopes to allow this on per-property basis. So, as things are things can be done. To further complicate things, while allowing merge would work for regular properties (once implemented), it is not certain how feasible it will be for parent/child properties; they go through additional processing. |
Thanks for your answer. Here is my proposition to start with a global configuration. First:
Then:
I can make a pull request if you confirm the design. |
(cherry picked from commit fe09779)
I opened a pull request implementing the described behaviour. |
Thank you for PR. It may take me some time to check it out -- changes are delightfully small (yay!), but since the change itself is potentially wide-ranging I want to make sure I understand consequences. |
I suspect #1399 might solve much of this issue, or perhaps all of it. Leaving open for now. |
#1399 is enough for us. |
@reda-alaoui perfect, thank you for following up on this! |
Hello,
I am using
Jackson 2.5.1
,Hibernate
and theJackson Hibernate Module
.Sometimes I need to merge a JSON String into an object returned by hibernate.
When the hibernate provided object contains an attribute of type
Set
(or another collection subtype), the attribute value is often a specific Hibernate collection implementation,PersistentSet
in our example.Merging a JSON into the hibernate provided object looks ok, except the collection implementation is changed by Jackson. In our example,
PersistentSet
is turned intoHashSet
.This behaviour leads later to an exception on save because Hibernate detect this inconsistency.
The problem seems located in
ManagedReferenceProperty.java
:The last method line replace the existing
PersistentSet
value with the newHashSet
value.When the collection is already initiliazed in the target object, would it be possible to keep it, clear it and populate it with the Jackson generated collection?
The text was updated successfully, but these errors were encountered: