博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
MyBatis中遇到的一些问题
阅读量:2386 次
发布时间:2019-05-10

本文共 2114 字,大约阅读时间需要 7 分钟。

  • MyBatis批量操作报错:Parameter 'xxxList' not found. Available parameters are [list]

Parameter 'bulletinTargetList' not found. Available parameters are [list]
因为我传的参数只有一个,而且传入的是一个List集合,所以mybatis会自动封装成Map<"list",bulletinTargetList>。在解析的时候会通过“list”作为Map的key值去寻找。但是我在xml中却声明成bulletinTargetList了,所以自然会报错找不到

参考地址

  • nested exception is org.apache.ibatis.binding.BindingException: Parameter 'G org.apache.ibatis.binding.BindingException: Parameter '__frch_item_0' not found. Available parameters are [paramMap, param1]

参考地址

http://blog.csdn.net/sinat_29325027/article/details/51143448

http://blog.csdn.net/moxiaoya1314/article/details/52410992

  • Mybatis绑定错误的原因--

1.mapper的namespace写的不对。

2.UserDao的方法在UserDao.xml中没有,然后执行UserDao的方法会报此

3. UserDao的方法返回值是List<User>,而select元素没有正确配置ResultMap,或者只配置ResultType!

4. 如果你确认没有以上问题,请任意修改下对应的xml文件,比如删除一个空行,保存。

按以下步骤一一执行:

1:检查xml文件所在的package名称是否和interface对应的package名称一一对应

2:检查xml文件的namespace是否和xml文件的package名称一一对应

3:检查函数名称能否对应上

4:去掉xml文件中的中文注释

5:随意在xml文件中加一个空格或者空行然后保存

1.检查实现类中方法是否存在

2.检查Service类的这个方法是否存在

3.检查Mapper类的这个方法

4.对应的mybatis 的配置文件是否存在,里面数据是否配置正确

5.检查Mapper类是否被加载了

参考地址

http://blog.csdn.net/yali1990515/article/details/52184553

http://blog.csdn.net/z69183787/article/details/48933481

  • Mybatis-There is no getter for property named 'id' in 'class java.lang.String'

http://blog.csdn.net/u011897392/article/details/46738747

  • Mybatis出现:无效的列类型: 1111错误

如果是参数是Map类型或者Java Object类型,如果Map或者Object里面的属性类型不一致,如有些属性是String类型,有些属性是Integer类型,那么MyBatis解析的时候,就会出现问题,类型无法识别。如果有类型不一致的情况,在值后面加上类型。

http://blog.sina.com.cn/s/blog_613963d10101hfw2.html
http://blog.csdn.net/fishernemo/article/details/27649233

还出现这样的问题:

No enum constant org.apache.ibatis.type.JdbcType.Integer

No enum constant org.apache.ibatis.type.JdbcType.date

在ibatis中不需要关注这些参数 而转到mybatis后 如果字段值为空 必须设置jdbcType

jdbcType = DATE,类型还必须大写,不能小写

jdbcType=INTEGER

http://blog.csdn.net/limingchuan123456789/article/details/30776747

  • MyBatis传入参数出现集合、数组,对空值的处理

http://blog.csdn.net/qq_20156845/article/details/54583912

方法中可能存在多个参数/类型不一致

https://blog.csdn.net/chengp919/article/details/77841296

https://blog.csdn.net/chengp919/article/details/78503844

你可能感兴趣的文章
ZZ Quick-Tip: Linux NAT in Four Steps using iptables
查看>>
北京的住房公积金是否可用于还外地的房贷
查看>>
mysqlhotcopy 热备工具体验与总结
查看>>
MooseFS安装笔记
查看>>
GlusterFS分布式集群文件系统安装、配置及性能测试
查看>>
Sakai
查看>>
Adobe ColdFusion Unspecified Directory Traversal Vulnerability
查看>>
使用grep恢复被删文件内容
查看>>
Quickly gathering logins/emails with theHarvester and Metasploit
查看>>
Share:A File Checksum Integrity Verifier utility
查看>>
LDAP User Authentication On CentOS 5.x
查看>>
Linux 下 Trac SVN apache SSL 配置安装以及整合
查看>>
Virtual Hosting With PureFTPd And MySQL (Incl. Quota And Bandwidth Management) On Fedora 13
查看>>
nux系统下强制踢掉登录用户
查看>>
windows 2008 r2 AD密码策略
查看>>
域策略+脚本实现客户端administrator帐号密码统一
查看>>
Joomla 1.5.12 RCE via TinyMCE upload vulnerability
查看>>
Cpanel PHP Restriction Bypass Vulnerability 0day
查看>>
用PXE引导调用kickstart安装CentOS 5
查看>>
Varnish权威指南(中文)
查看>>