nested exception is org.apache.ibatis.binding.BindingException: Parameter 'cityItem' not found. Available parameters are
时间: 2023-11-11 19:34:38 浏览: 34
这个异常提示是MyBatis的绑定异常,可能是因为你在使用MyBatis进行数据查询时,没有正确地传递参数。
具体地说,这个异常提示中提到了一个参数名叫做'cityItem',但是MyBatis找不到它。同时,异常提示中也提到了可用的参数列表。
你需要检查一下你的代码,看看是否正确地传递了参数,并且参数的名称是否与MyBatis的SQL语句中的参数名称一致。如果你使用的是注解方式进行SQL语句的映射,则需要检查一下@Param注解的名称是否正确。
相关问题
nested exception is org.apache.ibatis.binding.BindingException: Parameter 'name' not found. Available
nested exception is org.apache.ibatis.binding.BindingException: Parameter 'name' not found. Available parameters are [arg1, arg0, param1, param2]是指在MyBatis中发生的一个异常。该异常表示在执行SQL语句时,找不到参数'name'。可用的参数列表包括[arg1, arg0, param1, param2]。这意味着在SQL语句中需要使用这些参数之一来替换'name'。如果你想解决这个异常,你需要确保在执行SQL语句时提供正确的参数,并确保参数名称的一致性。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [nested exception is org.apache.ibatis.binding.BindingException: Parameter ‘xxx‘ not found解决方案](https://blog.csdn.net/weixin_46822367/article/details/121156670)[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%"]
- *3* [exception is org.apache.ibatis.binding.BindingException: Parameter ‘userId‘not found. Available ...](https://blog.csdn.net/qq_43658218/article/details/109141659)[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 ]
nested exception is org.apache.ibatis.binding.BindingException: Parameter 'workMeasures' not found.
引用[1]:nested exception is org.apache.ibatis.binding.BindingException: Parameter 'xxx' not found.Available parameters are [arg1, arg, param1, param2] 。 引[2]: 解决:请求异常:nested exception is org.apache.ibatis.binding.BindingException: Parameter 'fId' not found. Available parameters are [teacherInfo, page, param1, param2] ==================Detail===> [] 一·问题描述:(1)报错提示信息截图(2)mapper层代码截图(3)映射sql的xml文件:id在数据库表中设置了不为空,且没有默认值(4)postman测试接口传参截图 二·异常原因:(1)根本原因:动态sql语句里面,获取形参对象的fId属性值的格式不正确,导致无法获取对应值 三·解决方案:方案一:方案二: 四·测试结果:方案一:成功(1)mapper层代码:加@Param注解(2)映射sql文件:利用 “别名.属性名”,获取对象属性值(3)postman测试结果:成功 方案二:成功(1)mapper层代码:不加@Param注解(2)映射sql文件:利用 “形参对象名.属性名”,获取对象属性值(3)postman测试结果:成功 。 引用[3]: 二·异常原因: (1)根本原因:动态sql语句里面,获取形参对象的fId属性值的格式不正确,导致无法获取对应值 注意:由于数据库表设置了fId字段不为空,则插入、更新时必须给fId字段赋值, 但是本人这里是查询sql,所以跟这个fId主键约束没关系。 三·解决方案: 方案一: 。 问题:nested exception is org.apache.ibatis.binding.BindingException: Parameter 'workMeasures' not found.
回答: 这个错误提示是由于在MyBatis中找不到参数'workMeasures'导致的。根据引用[1]和引用[3]的内容,这个错误通常是由于动态SQL语句中获取形参对象的属性值的格式不正确所导致的。解决这个问题的方案可以有两种。方案一是在mapper层的代码中加上@Param注解,并在映射的SQL文件中使用"别名.属性名"的方式来获取对象的属性值。方案二是在mapper层的代码中不加@Param注解,并在映射的SQL文件中使用"形参对象名.属性名"的方式来获取对象的属性值。根据引用[2]中的描述,这两种方案都可以成功解决这个问题。请根据具体情况选择其中一种方案来解决你遇到的问题。