
注册时不断报这个错误,这个setbyid是我自定义的插入方法,
仔细查看,发现sql语句错了
<select id="setByid" resultType="integer">
insert into shirouser(id,create_time,updatatime,salt,password)
values(id=#{id},create_time=#{create_time},
updatatime=#{updatatime},salt=#{updatatime},password=#{password})
</select>
这里的 values后面的值应该直接是values( #{},#{}…) ,而不是 xx=#{xx} ,记录一下这个低级
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named ‘create_time’ in ‘class com.example.demo.pojo.shirouser’
还有这个报错,原因是我的xml文件中,插入语句的
#{create_time} 这个名字是数据库中的字段名,而我实体类中的的字段名是createtima ,又一个低级错误
2021/6/1
博客记录了注册时MyBatis的报错问题。一是自定义插入方法setbyid的SQL语句错误,values后格式有误;二是xml文件插入语句中,数据库字段名与实体类字段名不一致,导致报错。
889

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



