org.hibernate.PropertyNotFoundException: Could not find a getter for runningTime in class com.berheley.grb.model.EnergyConsumption
服务启动后经常报这个错误,但是实体类里面已经封装过了。而且这个错误不止一次两次,每次我把项目从tomcat remove后重新部署就会报这个错。每次我都要去把get,set删掉后重新封装一次。好奇怪,有大神知道这是什么原因吗。缓存什么的我都清理过的
private Integer runningTime ;
public Integer getRunningTime() {
return runningTime;
}
public void setRunningTime(Integer runningTime) {
this.runningTime = runningTime;
}
这个问题,我感觉你把runningTime改成RunningTime应该就行了,感觉应该是格式的问题,虽然你能生成,但是毕竟java是强类型语言,找不到也属于正常。
org.hibernate.PropertyNotFoundException: Could not find a getter for XXX
原因是持久类里面的字段名,和对应的映射文件hbm.xml 中property值不一样!仔细检查一下
Hibernate里面的配置写错了吧。。Hibernat里面的配置和分装类里面的属性不匹配的问题。。
实体映射关系如果使用的是注解,应该是没有这个问题的;如果实体映射关系是写在xml中的,应该是二楼说的问题。
很有可能是hibernate的映射文件里面的property配置有问题,没有对应上
很有可能是hibernate的映射文件里面的property配置有问题,没有对应上
那就每次去把get,set删掉后重新封装一次