美文网首页
org.apache.ibatis.reflection.Ref

org.apache.ibatis.reflection.Ref

作者: cmeizu | 来源:发表于2019-03-27 17:59 被阅读0次

这个问题发生在mapper声明函数传递参数时,与xml文件中的对应问题.
举一个例子如
mapper文件中这样写:

String selectByUserName(String username);

xml文件中:

<select id="selectByUserName" parameterType="java.lang.String" resultType="java.lang.String>
<if test="username != null">
  select password from user where username = #{username}
</if>
</select>

这时候会就出现标题中的错误.那怎么办呢?
加一个参数声明:

String selectByUserName(@Param("username") String username);

相关文章

网友评论

      本文标题:org.apache.ibatis.reflection.Ref

      本文链接:https://www.haomeiwen.com/subject/eirtbqtx.html