我的 java 应用程序使用 Ektorp 持久性 API http://ektorp.org/reference_documentation.html连接到 CouchDB以存储和检索对象。我正在尝试存储一个具有少量字符串属性的简单 bean,并使用 CouchDbConnector.create(mybean) 创建文档并使用 CouchDbConnector.get(mybean.class,doumentid) 检索文档。当我使用此处记录的 CouchDBDocument 扩展我的 bean 时http://ektorp.org/reference_documentation.html#d100e355,它在创建和检索文档时运行良好,但如果我不使用 CouchDBDocument 扩展它并注释“id”和此处列出的“修订”属性http://ektorp.org/reference_documentation.html#d100e31,
嵌套异常是 org.ektorp.DbAccessException: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "_id"
我通过将名称“id”更改为“_id”尝试了各种选项,但它不起作用。另外,我注意到,当我不使用 CouchDbDocument 扩展我的 bean 时,然后在 couchdb 中,文档中会创建一个“id”和“revision”字段以及“_id”和“_rev”。当我扩展 CouchDbDocument 时,不会创建这些字段。知道这里有什么问题吗?