4

I am using Spring Data REST using a CRUD repository, some values should be optionally NULL, however if I try to set them to null, the fields in question get ignored. If I send non-NULL data it works as expected

Is there are a way to allow this functionality?

Here is a sample PUT request body

{
 "name": "Ash Test",
 "distance": null,
 "paid": null,
 "startDate": null,
 "tags": [  ],
 "position": 3,
 "creator": true,
 "memberId": 55
}
5
  • are you using jackson? Commented Apr 19, 2013 at 13:12
  • 1
    related: stackoverflow.com/questions/12707165/… Commented Apr 19, 2013 at 13:14
  • Thanks for your answer, I am using jackson. That other question relates to the response I believe, I am concerned with updating an existing record with PUT. Commented Apr 19, 2013 at 13:55
  • Can you update with the values that you receieve? You really need to get the null values? Commented Apr 19, 2013 at 18:49
  • Hi Deividi, I am trying to do an update on the db(using PUT). As some background the data above represents a filter, if the value of paid in the db is true the filter will pull out records with paid = true, but if it's null the filter will ignore whether it's paid or not. This is why I want to be able to update the value in the DB to null. When I use the data above to do an update the paid field should be null, but it remains at it's previous value. Commented Apr 20, 2013 at 16:11

1 Answer 1

0

This appears to be a known issue at the time of this writing:

https://jira.springsource.org/browse/DATAREST-130

It affects both SDR 1.0.0.RELEASE and SDR 1.1.0.M1. I just tried it with 2.0.0.BUILD-SNAPSHOT and the nulls don't currently go through there either.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.