我正在使用spring-data-couchbase 2.1.2
,我用自定义查询重新定义了一个存储库:
@Override
public List<PortfolioDocument> searchPortfolio() {
CouchbaseOperations template = templateProvider.resolve(PortfolioRepository.class, PortfolioDocument.class);
String statement = "select META(ipdb).id AS _ID, META(ipdb).cas AS _CAS, * " +
"from ipdb where _class = 'com.ipdb.datamodel.document.PortfolioDocument' AND title = 'dummytitle'";
SimpleN1qlQuery query = N1qlQuery.simple(statement);;
List<PortfolioDocument> portfolioDocuments = template.findByN1QL(query, PortfolioDocument.class);
....
}
template.findByN1QL(query, PortfolioDocument.class);
返回一些PortfolioDocument
除了 id 属性之外的所有属性为 null。如果我调用template.findByOne(id);
生成的对象就可以了。你能帮我吗?