0
我正在使用spring jdbc和mongoDB。我將有如下文件。 一個像MongoDB,Spring JDBC,動態密鑰,映射
{
"_id" : ObjectId("58f49f05c88c8f2cb8061e12"),
"temp" : {
"27" : {
"59" : "5"
},
"28":{
"0":"0",
"1":"1"
}
},
"luminosity" : {
"27" : {
"59" : "3"
}
},
"identifier" : 753
}
和其他可能會像
{
"_id" : ObjectId("58f49f05c88c8f2cb8061e12"),
"humidity" : {
"27" : {
"59" : "5"
}
},
"identifier" : 753
}
所以你怎麼能寫我的映射類此。請幫忙! 我已經寫了類似
@Document(collection = "Data")
public class Data {
private String identifier;
/**
* @return the identifier
*/
public String getIdentifier() {
return identifier;
}
/**
* @param identifier
* the identifierto set
*/
public void setIdentifier(String identifier) {
this.identifier= identifier;
}
}
我怎麼能寫其他領域的映射器?這是動態的
你的數據結構是怪異。爲什麼有一個名爲「27」的對象,它代表什麼?如果你不能改變de datamodel你可以加載它作爲json對象或linkedtreemaps。 –
只是想知道下面的答案是否有幫助? – notionquest
@ p.streef數字表示分鐘/秒。感謝您的回覆 –