初学Java9:学习Mybatis时报错:Parameter 'name' not found. Available parameters are [1, 0, param1, param2]

报错-->Parameter ‘name‘ not found. Available parameters are [1, 0, param1, param2]

  百度找到这篇文章完成修改 http://blog.csdn.net/w86440044/article/details/29363067

  我之前写的操作类是和博主一样,是这样的:

1     // 登录·查询
2 @Select("select * from t_users where uname=#{name} and pswd=#{pswd}")
3 public Users findByNP(String name, String pswd);

  结果测试时弹出上面报错,按博主方法修改后:

1     // 登录·查询
2 @Select("select * from t_users where uname=#{0} and pswd=#{1}")
3 public Users findByNP(String name, String pswd);

  运行测试程序就正常了

  结果:那个地方不可以用名称匹配,还有其它原因吗?

初学Java9:学习Mybatis时报错:Parameter 'name' not found. Available parameters are [1, 0, param1, param2]

时间: 2024-10-13 12:29:26

初学Java9:学习Mybatis时报错:Parameter 'name' not found. Available parameters are [1, 0, param1, param2]的相关文章

Mybatis错误:Parameter 'XXX' not found. Available parameters are [1, 0, param1, param2]

Mybatis错误:Parameter 'XXX' not found. Available parameters are [1, 0, param1, param2] 原因:传递的参数超过一个 记 解决办法: (1)直接把值改成数字 <select id="LoginUser" parameterType="String" resultMap="userMap"> SELECT * FROM user where emplnumb

org.apache.ibatis.binding.BindingException: Parameter &#39;start&#39; not found. Available parameters are [1, 0, param1, param2]

DEBUG 2018-05-30 08:43:26,091 org.springframework.jdbc.datasource.DataSourceTransactionManager: Rolling back JDBC transaction on Connection [[email protected]]DEBUG 2018-05-30 08:43:26,091 org.mybatis.spring.SqlSessionUtils$SqlSessionSynchronization:

Mybatis报错:Parameter &#39;list&#39; not found. Available parameters are [groupList, param1]

GroupDao.java 里面定义的方法: void batchInsertLog(@Param("groupList") List<MktPromotionIntegralLog> groupList); 修改前的GroupMapper.xml <insert id="batchInsertLog" parameterType="java.util.List"> INSERT INTO table (ps_id,goo

Parameter &#39;name&#39; not found. Available parameters are [arg1, arg0, param1, param2]

解决方法: <select id="selectIf" resultType="student"> SELECT id,name,age,score FROM t_student WHERE 1=1 <if test="arg0 != null and arg0 !=''"> AND name LIKE '%' #{arg0} '%' </if> <if test="arg1>=0&quo

org.apache.ibatis.binding.BindingException: Parameter &#39;xxx&#39; not found. Available parameters are [arg1, arg0, param1, param2]

这个异常说明参数没有加上@Param注解,加上这个注解就行了. org.apache.ibatis.binding.BindingException: Parameter 'xxx' not found. Available parameters are [arg1, arg0, param1, param2] 原文地址:https://www.cnblogs.com/FengZeng666/p/12012727.html

使用RestTemplate时报错java.lang.IllegalStateException: No instances available for 127.0.0.1

我在RestTemplate的配置类里使用了 @LoadBalanced@Componentpublic class RestTemplateConfig { @Bean @LoadBalanced public RestTemplate restTemplate(){ return new RestTemplate(); }}或者 再调用@Autowiredprivate RestTemplate restTemplate;必须使用应用名作为代替ip:端口,http://127.0.0.1:8

java 传入多个参数时报&quot;Parameter &#39;XXX&#39; not found. Available parameters are [arg1, arg0, param1,...&quot; 解决方案

@Select("SELECT id FROM ae_post ORDER BY id DESC LIMIT #{page},#{size}") List<Post> getAllForPage(@Param("page") int page, @Param("size")int size); dao层写入,解决方法如上 注:多参数需要添加 @Param("参数名") int 参数名 java 传入多个参数时报&q

Redis连接时报错:Could not connect to Redis at 127.0.0.1:6379: Connection refused

Could not connect to Redis at 127.0.0.1:6379: Connection refused [[email protected] bin]# redis-cli Could not connect to Redis at 127.0.0.1:6379: Connection refused [[email protected] /]# redis-server /etc/redis.conf [[email protected] /]# redis-cli

解决mybatis foreach 错误: Parameter &#39;__frch_item_0&#39; not found

解决mybatis foreach 错误: Parameter '__frch_item_0' not found 在遍历对象的属性(是ArrayList对象)时报错: org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter '__frch_item_0' not found. Available parameters