您的位置:首页 > 编程语言 > Java开发

mybatis There is no getter for property named 'xx' in 'class java.lang.String

2014-04-28 17:58 615 查看
用mybatis查询时,传入一个字符串传参数,且进行判断时,会报 

There is no getter for property named 'positionName' in 'class java.lang.String

错误写法:

<select id="getPositionId" parameterType="string" resultType="java.lang.Integer">
select positionId from staffposition
<where>
<if test="positionName!=null and positionName!=''">positionName=#{positionName}</if>
</where>
</select>

需要修改成: 
<select id="getPositionId" parameterType="string" resultType="java.lang.Integer">
select positionId from staffposition
<where>
<if test="_parameter!=null and _parameter!=''">positionName=#{_parameter}</if>
</where>
</select>

不管你的参数是什么,都要改成"_parameter"
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  mybatis
相关文章推荐