resthub / resthub-spring-stack

RESThub Spring stack
http://resthub.org/spring-stack.html
Other
121 stars 66 forks source link

_class generated by resthub-mongodb spring profile #213

Closed SwathiMystery closed 10 years ago

SwathiMystery commented 11 years ago

I know this is a known issue with Spring that _class:"com.package.model" gets generated in the mongodb document. What is the workaround while using resthub-mongodb spring profile?

bmeurant commented 10 years ago

Sorry, I know this is an old question but I still answer :

This is indeed a well known and well commented issue in spring-data and resthub does not provide any specific workaround.

You can find below some really good resources about this subjet by Oliver Gierke from Spring team.

You can prevent the _class attribute to be generated but with caution : the _class information actually serves to properly manage polymorphism.

You'd better use @TypeAlias as suggested by Oliver again, to allow future refactorings.

http://forum.spring.io/forum/spring-projects/data/nosql/105045-spring-data-mongodb-mappingmongoconverter-remove-class

http://stackoverflow.com/questions/6810488/spring-data-mongodb-mappingmongoconverter-remove-class/