could not find a getter for ... in class ... 异常的原因解析
来源:互联网 发布:淘宝官方投诉电话号码 编辑:程序博客网 时间:2024/06/11 12:09
在spring+hibernate框架的Java项目开发过程中,经常会遇到这样的错误:
could not find a getter for ... in class ...
可能原因如下:
1.真的没有写getter方法(发生几率:1%)
2.*.hmb.xml文件中的属性名和pojo不一致(*.hbm.xml和*.java没衔接好,不一致),字段属性没有正确配置,比如,*.hmb.xml中*.java的地址要明确(明确指出引用包的完整路径);映射错误;有多个主键时,对生成的联合主键配置错误;拼写错误(包括多空格)等(发生几率:48%)
3.方法写错/方法名写错,要按照javabean的书写规范写啊,要不然打死也找不到哪儿错了(发生几率:50%)
这里提一下:get/set是不是不允许方法名中有连续两个大写字母,例如
public String getODPType(){
return this.oDPType;
}
public void setODPType(String oDPType){
this.oDPType = oDPType;
}
这样写它就会报错,报找不到getter for oDPType的错误,但下面这样写就可以了
public String odpType;
public String getOdpType(){
return this.odpType;
}
public void setOdpType(String odpType){
this.odpType = odpType;
}
4.其他不明原因(发生几率:1%)
(转自CSDN)
找错方法,顺着报错信息从后往前一步一步找,我遇到的报错信息解决方法就是在截图中路径下的那个文件解决的。
我遇到的是Javabean属性写错了,getXXx/SetXxx都错了, .hbm.xml配置文件却配对了
- could not find a getter for ... in class ... 异常的原因解析
- could not find a getter for ... in class ... 异常的原因解析
- could not find a getter for ... in class ... 异常的原因解析
- could not find a getter for ... in class ... 异常的原因解析
- could not find a getter for ... in class ... 异常的原因解析
- Could not find a getter for.. in class.. 异常原因
- could not find a getter for ... in class ... 异常的解决
- Debug:SSH继承时 could not find a getter for ... in class ... 异常的解决
- could not find a getter for ... in class ... 异常的解决
- could not find a getter for ... in class ... 异常的解决
- could not find a getter for in class方法解决
- could not find a getter for ... in class ...
- Could not find a getter for salesName in class
- could not find a getter for ... in class ...
- could not find a getter for ... in class ...
- Hibernate: Could not find a getter for **** in class
- org.hibernate.PropertyNotFoundException: Could not find a getter for titlse in class com.po.Intro异常
- org.hibernate.PropertyNotFoundException: Could not find a getter for titlse in class com.po.Intro
- Sqlerver数据库课程设计
- storm-[2]-storm基本模块编程
- Storm HBase遇到的问题
- SpringMVC+Spring阅读笔记——发展历程
- linux自己常用命令行
- could not find a getter for ... in class ... 异常的原因解析
- 为什么要使用redis?
- java web 404问题
- 23232
- jdk内置进制转换
- 模拟jQuery库,实现图片的隐藏和显
- oracle分区表按时间自动创建
- 将随机产生10个数的集合转成数组,并以数组的形式显示出来
- 在一个二维数组中,每一行都按照从左到右递增的顺序排序,每一列都按照从上到下递增的顺序排序。请完成一个函数,输入这样的一个二维数组和一个整数,判断数组中是否含有该整数。