parameterclass
repository层代码:
public int updName(String name) {
return updateDAO.execute("TABLENAME.updName", name);
}
sqlmap的sql语句
<update id="updName" parameterClass="java.lang.String">
update tableName set name='A' where 1=1
<dynamic>
<isNotempty prepend="and" property="value">
name = #value#
</isNotEmpty>
</dynamic>
<dynamic>
<isNotEmpty prepend="and" property="value">
name = #value#
</isNotEmpty>
</dynamic>
</update>
虽然java代码写的时候,传的参数是name,但在myBATis中,无论是property还是sql中的传参处,都得用value,否则就会显示:There is no READABLE property named xxx(此处为name)