-
Notifications
You must be signed in to change notification settings - Fork 562
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
@Transient annotation won't deserialize fields on MongoRepository PATCH requests [DATAREST-1524] #1881
Comments
Mark Paluch commented Moved to Spring Data REST as the issue is related to Spring Data REST |
bschoenmaeckers commented We are experiencing the issues as well since DATAREST-1383 has been fixed. This does not only occur on mongo repo's but also on other types. 2.1.5 is the latest working version |
bschoenmaeckers commented I implemented a fix. ProtenusBill, Could you try it and confirm if this fixes your issue? |
Oliver Drotbohm commented The "fix" is not complete unfortunately as it skips the complex object handling following the introduced guard. I.e. all the Generally speaking, properly PATCHing a document requires that in-depth processing of the incoming document. Your manually implemented controller actually applies PUT semantics, not PATCH ones. Just leave one field you submit away and see how it nulls that out, something that violates the contract of PATCH |
smozely commented Any workarounds for this? We are trying to get to a later version of Spring and been bitten by this with Transient properties on our JPA models.
|
ProtenusBill opened DATAREST-1524 and commented
I encountered this after upgrading from 2.1.x to 2.2.x. We have a class containing a field with a
@Transient
annotation - we want to read the field from the client's request but not store it in Mongo.Here's a nominal example:
MyBean.java
MyBeanRepository.java
MyBeanController.java
MyBeanEventListener.java
Here's the output on the following requests:
Default Create Endpoint
POST http://localhost:3002/services/v1/myBeans
Persist is null? false
No persist is null? false
Default Modify Endpoint
PATCH http://localhost:3002/services/v1/myBeans/5ec6ab4eb2c37203c6d546fe
Persist is null? false
No persist is null? true
Custom Modify Controller
PATCH http://localhost:3002/services/v1/myBeans/modify/5ec6ab4eb2c37203c6d546fe
Persist is null? false
No persist is null? false
I tried a myriad of combinations of Jackson
@JSONX
... annotations to no avail. My assumption is that the@Transient
annotation should not affect JSON serialization/deserialization so this appears to be a bugAffects: 3.2.7 (Moore SR7)
Issue Links:
2 votes, 6 watchers
The text was updated successfully, but these errors were encountered: