问题:在使用SpringMvc时,容易出现此问题:
Invalid bound statement (not found): com.xxx.dao.xxxDao.selectByxx错误!!!!很简单
原因分析:
(1)dao层的方法和mapper.xml中的方法不一样;
(2)mapper中的namespace resultParameter 和对应的dao层entity层不一样
(3)就是在mapper映射时,因返回值类型不一样
解决思路:
(1)查看对应的返回类型,是不是在对应的Dao层里
(2)找到class为org.mybatis.spring.SqlSessionFactoryBean 这个bean
(3)找到name为mapperLocations的property

SpringMVC中MyBatis错误解析
本文分析了在使用SpringMVC框架时遇到的MyBatis 'Invalid bound statement (not found)' 错误,详细解释了可能的原因,包括DAO层与mapper.xml不匹配、namespace或参数类型错误等,并提供了检查返回类型、配置SqlSessionFactoryBean及mapperLocations属性的解决思路。

被折叠的 条评论
为什么被折叠?



