ibatis.binding.BindingException: Parameter ‘productId‘ not found. Available parameters are [pageable

出错详细信息:

org.apache.ibatis.binding.BindingException: Parameter 'productId' not found. Available parameters are [pageable, abcProduct, param1, param2]

原因:

1 mapper接口文件中,多个参数时,没有加 @Param("abcProduct") AbcProduct abcProduct 注解

2 相应的xml文件中,也要做相应的修改abcProduct.productId,abcProduct.productPrice的形式

下面的修改的正确的写法,代码不全,只是展示如何修正:
 

List<AbcProduct> queryAllByLimit(@Param("abcProduct") AbcProduct abcProduct,
                                     @Param("pageable") Pageable pageable);
<if test="abcProduct.productStock != null">
                and product_stock = #{abcProduct.productStock}
            </if>
        </where>
        limit #{pageable.offset}, #{pageable.pageSize}
    </select>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
org.apache.ibatis.binding.BindingException: Parameter 'id' not found. Available parameters are [map, param1是MyBatis框架的异常信息。这个异常通常是由于MyBatis在执行SQL语句时未能找到指定的参数引起的。根据引用和引用的信息,这个异常的原因可能是在SQL语句中使用了参数'id',但是在实际执行时未传入对应的值。可用的参数有'map'和'param1'。要解决这个异常,您可以检查SQL语句中的参数名是否正确,并确保在执行时传入了正确的参数值。另外,您还可以在MyBatis的settings中使用useActualParamName属性,并在使用Java 8及以上版本时加上-parameters参数,以实现在多参数情况下无需使用@Param注解。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [org.apache.ibatis.binding.BindingException: Parameter ‘id‘ not found.Available parameters are参数...](https://blog.csdn.net/T_Y_F_/article/details/126963292)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* *3* [mybatis Cause: org.apache.ibatis.binding.BindingException: Parameter 'id' not found. Available param...](https://blog.csdn.net/weixin_42191498/article/details/129153633)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值