mappedBy reference an unknown target entity property解决方法

来源:互联网 发布:穿越火线优化软件 编辑:程序博客网 时间:2024/05/23 15:47

错误原因:在one-to-many注解配置: @OneToMany(targetEntity=SmallProductClass.class,mappedBy="BigProductClass"),mappedBy指向的是要关联的属性,而不是要关联的类,

      如果这样配置,hibernate则会找com.myweb.webPractice.entity.SmallProductClass类下面的BigProductClass属性。但实际上没有这个属性,就会报上面的异常
   方法:指定到实际关联的属性:即:@OneToMany (mappedBy = " bigProductClass")

0 0