org.hibernate.PropertyNotFoundException: Could not find a getter for empDeptId in class com.legend.shipment.Temployee
org.hibernate.PropertyNotFoundException: Could not find a getter for empDeptId in class com.legend.shipment.Temployee
出现这个错误的原因:
属性名类似于这样的cName生成的get方法会是这样
public java.lang.String getCName()
{
return this.cName;
}
*.hmb.xml中的属性名和pojo中的不一致,就会出问题,把get方法改成这样就可以了
public java.lang.String getcName()
{
return this.cName;
}
本文探讨了Hibernate框架中PropertyNotFoundException的问题及解决方案。主要原因是.hbm.xml文件中的属性名与POJO类中的属性名不一致导致。通过调整get方法名称可以有效解决此问题。
9052

被折叠的 条评论
为什么被折叠?



