BUG集-java-mybatis-Table ‘jt.demouser‘ doesn‘t exist
作者:互联网
项目场景:
提示:这里简述项目相关背景:
mybatis查询数据
问题描述:
提示:这里描述项目中遇到的问题:
org.apache.ibatis.exceptions.PersistenceException:
Error querying database. Cause: java.sql.SQLSyntaxErrorException: Table ‘jt.demouser’ doesn’t exist
The error may exist in mybatis/mappers/DemoUserMapper.xml
The error may involve defaultParameterMap
The error occurred while setting parameters
SQL: select * from DemoUser
Cause: java.sql.SQLSyntaxErrorException: Table ‘jt.demouser’ doesn’t exist
原因分析:
提示:xml配置文件SQL语句的表名和数据库的不一样
<mapper namespace="com.jt.mappers.DemoUserMapper">
<select id="findAll" resultType="com.jt.pojo.DemoUser">
select * from DemoUser
</select>
</mapper>
解决方案:
提示:修改xml SQL语句的表名
<mapper namespace="com.jt.mappers.DemoUserMapper">
<select id="findAll" resultType="com.jt.pojo.DemoUser">
/*select * from DemoUser*/
--修改后
select * from demo_user
</select>
</mapper>
标签:xml,demouser,java,jt,doesn,exist,DemoUser,select 来源: https://blog.csdn.net/weixin_49573452/article/details/120811801