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数字表示分钟/秒。感谢您的回复 –