Caused by: org.hibernate.AnnotationException: mappedBy reference an unknown target entity property:

萝らか妹 提交于 2019-12-06 01:36:46

The message is pretty clear. You're saying to JPA: this OneToMany is the inverse side of the ManyToOne, defined in the Delivery entity, by the field deliveries. But there is no field deliveries in Delivery. The corresponding field in Delivery is named purveyor:

@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name = "ref_purveyor")
private Purveyor purveyor;
                   ^-- this is the other side of the association

So what you need is

@OneToMany(fetch=FetchType.LAZY,mappedBy = "puveyor")

Your mapping should look like this

Purveyor {

 @OneToMany(fetch=FetchType.LAZY,mappedBy = "purveyor")
 private List<Delivery> deliveries = new ArrayList<Delivery>();

}    

Delivery {

    @ManyToOne(fetch=FetchType.LAZY)
    @JoinColumn(name = "ref_purveyor")
    private Purveyor purveyor;

}
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!