我从数据库中得到了这样的json类型:
[
{
"a": 1,
"ids": {
"1b": [1, 2],
"2b": [3, 4, 5]
}
},
{
"a": 2,
"ids": {
"1b": [6, 7, 8],
"2b": [9]
}
}
]
实体看起来像这样 实体:
@Entity
public class myEntity {
@Column(name="foos", columnDefinition="json") //doesn't work
List<Foo> foos;
//the rest...
}
public class Foo {
private Long a; //ej: "1"
private Map<String, List<Long>> ids; //ej: {"1b": [1, 2]}, {"2b":[3,4,5]}
//the rest...
}
因为它不会自动转换。我如何从该json转到我的Foo列表?