正確用法 @OneToOne(mappedBy = "post") @JsonView(View.Detail.class) private HotPost hotPost; 一開始犯傻 @OneToOne(mappedBy = "post") @JsonView(View.Detail.class) Sethotpost = new HashSet<>(0); CautionsCautionsCautions log只會說:Unknown mappedBy in: com.ws.pojo.Post.hotPost, referenced property unknown: java.util.Set.post but @OneToMany remember to use Set
ref:
http://stackoverflow.com/questions/25756993/difference-between-one-to-one-vs-many-to-one-with-unique-true
沒有留言:
張貼留言