ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

mybatis问题BUG集

2021-09-26 10:02:09  阅读:383  来源: 互联网

标签:xml ibatis 问题 apache mybatis org Cause BUG ###


 报错说明1:

org.apache.ibatis.binding.BindingException: Type interface com.jt.mapper.UserMapper is not known to the MapperRegistry.

解决方案1:
检查namespace命名是否与接口一致

报错说明2:

org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.jt.mapper.UserMapper.findAll

解决方案2:
检查xml映射文件中的ID是否与接口方法一致.
 

报错说明3:

The error may exist in mybatis/mappers/UserMapper2.xml

解决方案3:
检查mybatis核心文件加载mapper映射文件的路径是否正确.

报错说明4:

Cause: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is ‘mybatis/mappers/demoUserMapper.xml’. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias ‘DemoUser’. Cause: java.lang.ClassNotFoundException: Cannot find class: DemoUser

解决方案4:
问题可能是xml映射文件中的resultType的类型异常.
 

报错说明5:

org.apache.ibatis.exceptions.PersistenceException: 
### Error querying database.  Cause: java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'from demo_user where sex = '女' and age < 100' at line 1
### The error may exist in mybatis\mappers\demoUserMapper.xml
### The error may involve defaultParameterMap
### The error occurred while setting parameters
### SQL: select  from demo_user where sex = ? and age < ?
### Cause: java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'from demo_user where sex = '女' and age < 100' at line 1

解决方案5:
问题是sql语句错误

报错说明6:
org.apache.ibatis.exceptions.PersistenceException: 
### Error building SqlSession.
### The error may exist in mybatis\mappers\DemoUserMapper.xml
### Cause: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'mybatis\mappers\DemoUserMapper.xml'. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'com.jt.pojo.DemoUserp'.  Cause: java.lang.ClassNotFoundException: Cannot find class: com.jt.pojo.DemoUserp

解决方案:检查.xml映射文件中resultType的值,是否与实体对象路径一致
 

标签:xml,ibatis,问题,apache,mybatis,org,Cause,BUG,###
来源: https://blog.csdn.net/wohaoniua/article/details/120481403

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有