@Id and @Field on same variable?

放肆的年华 提交于 2020-01-04 05:41:17

问题


Is there a way to achieve @Id and @Field on the same variable of a @Document so the variable is also saved inside the document? I'm trying to preserve the data I'm importing as much as I can, even though I get the design practices followed by the developers.


回答1:


The @Id annotation will take priority over @Field, so no the id cannot be persisted as both document ID and value inside the document. Quickest way to achieve that is probably to duplicate the id field as a separate @Field annotated attribute?



来源:https://stackoverflow.com/questions/39571003/id-and-field-on-same-variable

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