[SSM]There is no getter for property named 'token_exptime' in 'class com.hdu.model.Student'
2016-11-14 11:31
811 查看
org.mybatis.spring.MyBatisSystemException : nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named ‘token_exptime’ in ‘class com.zyd.beans.Admin’
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:73)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:365)
Caused by: org.apache.ibatis.reflection.ReflectionException : There is no getter for property named ‘usersname’ in ‘class com.zyd.beans.Admin’
…
原因:
实体类的定义里和数据库里列名定义相同为token_exptime,因此自动获取到的变量都是和实体类中定义的相同名字为token_exptime,
但在mapping的xml文件中数据库语句里
![](http://img.blog.csdn.net/20161114112623143)
token_exptime 写成了tokenExptime,spring找不到token_extime因此就报错.
反观这个错误发生的原因,这个mapping.xml文件是mybatis generater
自动生成的,数据库中定义为token_exptime,所以只能有一个可能那就是自动生成的代码中对参数的定义是没有下划线”_”这种符号的,所以以后在数据库中定义属性名字是不应该带下划线,否则要改很多地方。
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:73)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:365)
Caused by: org.apache.ibatis.reflection.ReflectionException : There is no getter for property named ‘usersname’ in ‘class com.zyd.beans.Admin’
…
原因:
实体类的定义里和数据库里列名定义相同为token_exptime,因此自动获取到的变量都是和实体类中定义的相同名字为token_exptime,
但在mapping的xml文件中数据库语句里
token_exptime 写成了tokenExptime,spring找不到token_extime因此就报错.
反观这个错误发生的原因,这个mapping.xml文件是mybatis generater
自动生成的,数据库中定义为token_exptime,所以只能有一个可能那就是自动生成的代码中对参数的定义是没有下划线”_”这种符号的,所以以后在数据库中定义属性名字是不应该带下划线,否则要改很多地方。
相关文章推荐
- There is no getter for property named 'itmesCustom' in 'class com.ssm.po.Ite
- There is no getter for property named 'xxx' in 'class com.xuezhixin.mls.web.model.yyy
- There is no getter for property named 'user' in 'class com.gao.model.Message
- There is no getter for property named 'depart' in 'class com.xuezhixin.mls.web.model.Major'
- SSM框架分页的时候报错 There is no getter for property named 'xx' in 'class java.lang.String
- There is no getter for property named 'ItemsCustomer' in 'class cn.itcast.ssm.pojo.ItemsCustomerVo'
- There is no getter for property named 'studentno ' in 'class java.lang.String'
- There is no getter for property named 'UserCustom' in 'class com.hry.pojo.UserQueryVo'
- There is no getter for property named 'value' in 'class com.hl.myabtis.first.beas.User'
- 关于myBatis的问题There is no getter for property named 'USER_NAME' in 'class com.bky.model.实例类'
- resultMap使用不当导致出现There is no WRITEABLE property named 'student_id' in class 'com.ssi.model.Stud
- There is no getter for property named 'insurance_id' in 'class studio.geek.entity.StudentInsurance'
- Mybatis-异常-There is no getter for property named 'VARCHAR' in 'class com.xxx.xxxxx
- FAQ(32):There is no getter for property named 'userrName' in 'class com.smbms.pojo.User'
- mybatis There is no getter for property named 'xx' in 'class java.lang.String
- MyBatisSystemException ReflectionException: There is no getter for property named 'userid' in 'class
- Mybatis-There is no getter for property named 'tj' in 'class
- There is no getter for property named 'num' in 'class java.lang.String'。
- Mybatis-There is no getter for property named 'XXX' in 'class java.lang.String'解决办法
- There is no getter for property named 'xxx' in 'class java.lang.Long'