You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been experimenting with an optimal combination of Lombok annotations, generated identity fields and version support.
Along the way, I've found that if the identity field or the version field are immutable (and thus with() methods used for property updates) then the property updates applied during save() are not propagated back to the returned object instance.
This appears to be due to expecting the updates to be applied to the passed in object instance, but "withers" return new object instances which are dropped along the way.
the object instance "o" (or "object") is never updated with the generated Id value or the result of "applyUpdatedCas()" if the property accessor results in a new object instance (as is the case with "wither" and final properties)
well sure, but then you can't follow the documentation's advice for modeling objects.
Ie - it seems the contract being offered by the higher-level spring data mapping constructs is "you can (and should) use immutable objects, just make sure to provide wither methods for id and version properties", but spring data couchbase's implementation falls short.
In the spirit of "it just works if I follow the instructions and advice", I'd expect to be able to use this simple immutable data class w/o gymnastics:
jpringle opened DATACOUCH-625 and commented
I've been experimenting with an optimal combination of Lombok annotations, generated identity fields and version support.
Along the way, I've found that if the identity field or the version field are immutable (and thus with() methods used for property updates) then the property updates applied during save() are not propagated back to the returned object instance.
This appears to be due to expecting the updates to be applied to the passed in object instance, but "withers" return new object instances which are dropped along the way.
Ie, in ReactiveUpsertByIdOperationSupport.one():
the object instance "o" (or "object") is never updated with the generated Id value or the result of "applyUpdatedCas()" if the property accessor results in a new object instance (as is the case with "wither" and final properties)
Referenced from: pull request #274
Backported to: 4.0.5 (Neumann SR5)
The text was updated successfully, but these errors were encountered: