私はspring jdbcとmongoDBを使用しています。私は次のような書類を持っています。 1は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"というオブジェクトがあり、それは何を表していますか?データモデルを変更できない場合は、jsonオブジェクトまたはlinkedtreemapsとしてロードするだけです。 –
以下の答えが有用かどうか疑問に思っていますか? – notionquest
@ p.streef数値は分/秒を表します。返信ありがとうございます –