5
在Spring Data REST中发布@OneToMany子资源关联
目前,我有一个使用Spring Data REST的Spring Boot应用程序。我有一个域实体Post,它@OneToMany与另一个域实体有关系Comment。这些类的结构如下: Post.java: @Entity public class Post { @Id @GeneratedValue private long id; private String author; private String content; private String title; @OneToMany private List<Comment> comments; // Standard getters and setters... } Comment.java: @Entity public class Comment { @Id @GeneratedValue private long id; private String author; private String …