Myatis错误记录
Mybatis连接出错
刷新了一下maven出现报错
出现这个错误可以尝试在pom里面加上
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
但是异常还是没有被解决
原因是这里多写了jdbc
改成这里就好了
实体类的数据类型和数据库中的类型不一致
org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: org.apache.ibatis.executor.result.ResultMapException: Error attempting to get column 'gender' from result set. Cause: java.sql.SQLDataException: Cannot determine value type from string '男'
### The error may exist in com/softeem/mapper/UserMapper.xml
### The error may involve com.softeem.mapper.UserMapper.getUserList
### The error occurred while handling results
### SQL: select * from tb_User;
### Cause: org.apache.ibatis.executor.result.ResultMapException: Error attempting to get column 'gender' from result set. Cause: java.sql.SQLDataException: Cannot determine value type from string '男'
检查数据库的数据类型与实体类型是否一致
找不到路径 java.io.IOException: Could not find resource mappers/UserMapper.xml
原来是mapper的路径的问题
一定不要com.softeem.mapper这样是错误的,还是一个一个的创建
org.apache.ibatis.binding.BindingException: Type interface com.softeem.mapper.SelectMapper is not known to the MapperRegistry.
在开始学Mybatis的时候,,很可能会出现这个问题,意思就是这个接口没有被注册,检查自己的Mybatis配置里面的mapper路径
这里直接改成package以包命名就行
怎么都找不到mybatis-config.xml的文件
检查了配置的路径还有都没问题,发现我的项目没有target目录,原来是pom文件没有加这行代码,添加上就好了
<packaging>jar</packaging>