Cause: org.apache.ibatis.type.TypeException: Could not set parameters for mapping
报错:Cause: org.apache.ibatis.type.TypeException: Could not set parameters for mapping。parameterType等号后面只写了user,而不是com.entity.User。parameterType等号后面的属性应该和接口代码的传参相对应。是我在mybatis-config.xml加了配置代码。翻译过来大概就是映
·
报错:Cause: org.apache.ibatis.type.TypeException: Could not set parameters for mapping
翻译过来大概就是映射出错
具体原因是
接口代码:
Integer updateById(User user);
xml里的sql代码
<update id="updateById" parameterType="user">
UPDATE user SET
username=#{username},
password=#{password},
birthday=#{birthday},
address=#{address},
sex=#{sex},
age=#{age}
WHERE id=#{id}
</update>
parameterType等号后面的属性应该和接口代码的传参相对应
parameterType等号后面只写了user,而不是com.entity.User
是我在mybatis-config.xml加了配置代码
<!-- 别名-->
<!-- 给所有的com.woniu.entity包下的实体类都起一个别名,所有的别名都是类名首字母小写-->
<typeAliases>
<package name="com.woniu.entity"/>
</typeAliases>
更多推荐
已为社区贡献1条内容
所有评论(0)