Save null value with Spring repository to mongodb document

血红的双手。 提交于 2020-01-03 13:41:50

问题


I want to save a null value to a document with a Spring Data Repository.

So someEntity below is an object with a property set to null in java.

...
repository.save(someEntity);
...

Spring will save this as undefined, meaning the property of the document is not set to null. In our use case, we treat null as a proper value.

How can you solve this without overriding the save() method in the repository?

来源:https://stackoverflow.com/questions/27187749/save-null-value-with-spring-repository-to-mongodb-document

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!