Hibernate常见异常及解决办法(1)

来源:互联网 发布:杰刚队长知乎 编辑:程序博客网 时间:2024/06/05 22:53

Illegal attempt to map a non collection as a @OneToMany, @ManyToMany or @CollectionOfElements异常

private HashSet<jobExperience> jobExperiences = new HashSet<jobExperience>();

这里改成

private Set<jobExperience> jobExperiences = new HashSet<jobExperience>();

同时修改相应的getter和setter方法,即可。



mappedBy reference an unknown target entity property异常

@OneToMany(mappedBy="Talent")

这里写具体的属性不是类。改成

@OneToMany(mappedBy="id")
0 0