【发布时间】:2020-06-22 00:53:09
【问题描述】:
在 spring 数据中,我有一个使用 EntityStatus 的 Entity。
当我使用 @Controller 序列化 json 时,EntityStatus 的 id 被删除。
这是生成的实体的外观:
{
"description" : "Some testing",
"version" : null,
"createdDate" : "2020-03-10T05:46:25.516Z",
"createdById" : null,
"lastModifiedById" : null,
"title" : "This is a test",
"content" : "Foo bar fizz buzz",
"userId" : 2,
"category" : {
"description" : "Foobar",
"version" : null,
"createdDate" : "2020-03-10T05:18:30.282Z",
"lastModifiedDate" : "2020-03-10T05:18:41.827Z",
"createdById" : null,
"lastModifiedById" : null,
"deleted" : false
},
"status" : {
"description" : "Created"
},
"deleted" : false,
"_links" : {
"self" : {
"href" : "http://localhost:8080/management/entity/5"
}
}
}
如何强制将其包含在全球所有子实体中?
【问题讨论】:
-
这能回答你的问题吗? Expose all IDs when using Spring Data Rest
-
不,不是因为我不使用 JPA
标签: java spring spring-boot spring-data spring-data-rest