使用String
从数据库检索对象时,是否只能将子对象的id存储为database.load("objectId")
属性?
在此处查看文档:{{3}}
更多信息
POJO
class Person {
@Id
private String id;
private Address address;
}
class Address {
@Id
private String id;
// Not loaded using lazy loading
private String city;
}
相应的构建对象:
{
"id": "#10:10",
"address": {
"id": "#15:2"
}
}
除了address
字段(现在是String
)之外,POJO都是相同的。
class Person {
@Id
private String id;
private String address;
}
// I didn't add again the code for Address POJO
所寻求的JSON:
{
"id": "#10:10",
"address": "#15:2"
}