1
productChanges
集合中的文檔如下所示。帶子文檔的Spring mongotemplate查詢結果
{
"_id" : NumberLong(9780876590034),
"isbn" : NumberLong(9780876590034),
"updDtime" : ISODate("2016-06-08T14:02:29.044Z"),
"Audit" : {
"LastProcCntrlNo" : 100192211,
"UpdDtime" : ISODate("2016-06-08T14:02:29.044Z"),
"AddDtime" : ISODate("2016-06-08T14:02:29.044Z")
}
}
我有我的ProductChanges.java
類
public class ProductChanges {
Long isbn;
Date updDtime;
Audit audit;
// getters & setters
}
我用mongoTemplate
來查詢數據庫,但我不能讓填充Audit
對象。
// query the DB
List<ProductChanges> productChanges = mongoTemplate.find(query, ProductChanges.class, "productChanges");
這應該是直截了當的。我需要註釋我的Audit
對象嗎?我錯過了一些微不足道的東西嗎?
Spring Data MongoDB文檔無助於找到此問題的答案。基於該Spring Data MongoDB documentation
「我無法獲得審覈對象填充」:描述發生了什麼。任何錯誤消息?列表簡單的時候不應該是空的嗎? –
@ antoine-sac沒有錯誤信息。 'productChanges'填充了條目,但'audit'始終爲空。 – ravindrab