关于org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.atguigu.crud.dao.DepartmentMapper.insertSelective的错误

时间:2023-03-10 01:59:36
关于org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.atguigu.crud.dao.DepartmentMapper.insertSelective的错误

今天我在使用mybatis逆向工程的时候,由于一个疏忽字打错了。。结果花了一早上才把错误找全。。广大小伙伴们一定要小心啊(能复制粘贴就别手打)

关于org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.atguigu.crud.dao.DepartmentMapper.insertSelective的错误

在设置逆向工程的xml的时候 一定要将左边的包名和设置的名字一一对应(强烈建议直接复制粘贴)

关于org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.atguigu.crud.dao.DepartmentMapper.insertSelective的错误

比如javabean的 targetPackage = “包名” 这个地方如果写错了一个字母,那么将会重新生成一个新的包

关于org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.atguigu.crud.dao.DepartmentMapper.insertSelective的错误

关于org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.atguigu.crud.dao.DepartmentMapper.insertSelective的错误

而万一不小心打错字了,并且你已经意识到了,并将包名重新改了过来,但却还是报错!并且出现

org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.atguigu.crud.dao.DepartmentMapper.insertSelective的错误的时候

关于org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.atguigu.crud.dao.DepartmentMapper.insertSelective的错误

一定要先去看看Spring的配置文件applicationContext.xml的配置有没有问题

关于org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.atguigu.crud.dao.DepartmentMapper.insertSelective的错误

如果一切正常,那还有一个最最最最重要的地方,去找与之dao层文件对应而生成的xml文件看看(由于逆向工程包名打漏或其他情况),打开xml 直接找到最上方<mapper namespace="com.atguigu.crud.dao.DepartmentMapper">,这里与dao包对应 。

逆向工程如果将dao包标志错了,那么这里也会出错

关于org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.atguigu.crud.dao.DepartmentMapper.insertSelective的错误

这个恶心了我一早上的问题。。我也是第一次合并ssm框架 发个提醒希望大家不要采雷。