mongodb - Post to Spring MVC controller with domain class that has Mongo @DBref not working -
mongodb - Post to Spring MVC controller with domain class that has Mongo @DBref not working -
i have domain model created productcategory, , 1 of fields has @dbref annotated parentcategory, following:
@document public class productcategory{ @id private string id; private string name; @dbref private productcategory parentcategory; setter.getter... } my controller simply
@requestmapping(value="/api/category", method=requestmethod.post) public @responsebody productcategory addcategory(@requestbody productcategory category) { homecoming category; } i tried $ref noted mongodb documentation, can't build json post in way server recognizes parentcategory. give me error message
org.springframework.http.converter.httpmessagenotreadableexception: not read json: unrecognized field "$ref"
i read through http://docs.spring.io/spring-data/data-mongodb/docs/1.5.0.release/reference/htmlsingle/#mapping-usage-references , spring documentation , can't find related.
do need create custom httpmessageconverter?
spring mongodb spring-mvc spring-mongo
Comments
Post a Comment