廣告

2016年5月19日 星期四

Hibernate  one-to-one mapping cautions


正確用法
@OneToOne(mappedBy = "post")
@JsonView(View.Detail.class)
private HotPost hotPost;

一開始犯傻
@OneToOne(mappedBy = "post")
@JsonView(View.Detail.class)
Set hotpost = 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:




沒有留言:

張貼留言