mybatis注解开发中update注解多个参数

Caused by: org.apache.ibatis.binding.BindingException: Parameter 'pwd' not found. Available parameters are [1, 0, param1, param2]
at org.apache.ibatis.binding.MapperMethod$ParamMap.get(MapperMethod.java:186)
at org.apache.ibatis.reflection.wrapper.MapWrapper.get(MapWrapper.java:45)
at org.apache.ibatis.reflection.MetaObject.getValue(MetaObject.java:122)
at org.apache.ibatis.scripting.defaults.DefaultParameterHandler.setParameters(DefaultParameterHandler.java:79)
at org.apache.ibatis.executor.statement.PreparedStatementHandler.parameterize(PreparedStatementHandler.java:93)

。。。

在运行项目中出现以上错误;

错误代码:

/*
 * 错误的注解使用方式	
 * 
 * */
	@Update("update test set password=#{pwd} where id=#{id}")
	public void updateOfPwd(String pwd,Integer id);

修改上述代码后运行正常,修改后的代码为:

	@Update("update test set password=#{0} where id=#{1}")
	public void updateOfPwd(String pwd,Integer id);

多个参数,sql使用下标来标识




猜你喜欢

转载自blog.csdn.net/a1286160028/article/details/79840379