java.lang.IllegalStateException:No typehandler found for property
程序员文章站
2022-07-15 16:16:25
...
错误场景:
搭建ssm项目启动报错
详细的堆栈信息:
No typehandler found for property lvlReward
at org.apache.ibatis.mapping.ResultMapping$Builder.validate(ResultMapping.java:151)
at org.apache.ibatis.mapping.ResultMapping$Builder.build(ResultMapping.java:140)
at org.apache.ibatis.builder.MapperBuilderAssistant.buildResultMapping(MapperBuilderAssistant.java:394)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.buildResultMappingFromContext(XMLMapperBuilder.java:378)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElement(XMLMapperBuilder.java:280)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElement(XMLMapperBuilder.java:252)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElements(XMLMapperBuilder.java:244)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:116)
错误原因:
遇到这个错误试了很多网上的方法,都不能解决,最后找到解决方案,顺便把出现错误的几种原因总结了一下
1、mapper文件中的所写的对象属性名和数据库字段名不能对应
<result column="expiryDate" property="expiry_Date" >
2、mapper文件中的所写的对象属性类型和数据库字段类型不对应
3、对象属性的set方法中类型和数据库字段类型不对应(笔者错误)
解决方式:
查看这几个地方的属性名和类型是否对应,修改即可
上一篇: D-有趣的数字
推荐阅读
-
java.lang.IllegalStateException: No typehandler found for property params
-
SpringBoot :No property xx found for type xx!
-
java.lang.IllegalStateException:No typehandler found for property
-
Property or field ‘XXX‘ cannot be found on null
-
org.springframework.data.mapping.PropertyReferenceException: No property xxx found for type xxx
-
使用spring-data-jpa进行count时报错No property count found for type xxx的解决方案
-
No property name found for type XXX解决
-
Spring Data JPA: No property name found for type ×××
-
Spring Data: no property xxx found for type xxxx
-
JPA踩坑:No property xxx found for type xxx