Java开发常见错误:org.mybatis.spring.MyBatisSystemException
来源:互联网 发布:js data- 编辑:程序博客网 时间:2024/04/20 21:54
org.apache.ibatis.binding.BindingException: Parameter 'username' not found. Available parameters are [param1, tag]
《===================================解决方案一======================================》
传递的参数为Map类型一直对Map类型作为参数不是很熟悉,后来定位到Map参数取值问题。原因是:Dao接口里面使用了@Param 而参数为Map时,去参数应该是#{paraMap.email}
public List<Book> getBooksUnderEmailAndTag(@Param(value="tag")Map<String,String> paraMap);《===================================解决方案二=======================================》
一般出项这种情况,都是有关联对象,而且想一次性添加或者修改。可以使用分离对象添加或修改。
比如User和Department对象。User中有dep_id.这样我们可以先通过depId查出dep的name。先设置user的部门为dep.
然后再添加User对象。想这样的逻辑处理可以放到service层。。
UserService中。
public void update(User user,int depId) {Department dep=departmentDao.load(depId);user.setDepartment(dep); //设置部门this.userDao.update(user); //添加User对象。}
至于SQL不用改变,一次性写好。
insert into t_user(username,password,nickname,dep_id) value(#{username},#{password},#{nickname},#{department.id});
1 0
- Java开发常见错误:org.mybatis.spring.MyBatisSystemException
- org.mybatis.spring.MyBatisSystemException
- org.mybatis.spring.MyBatisSystemException
- org.mybatis.spring.MyBatisSystemException
- SSM_bug:org.mybatis.spring.MyBatisSystemException:
- Spring+mybatis错误:org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.bi
- Spring+MyBatis 错误:org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.b
- Spring错误:org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.Bi
- Spring错误:org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.B
- Spring错误:org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.Bi
- nested exception is org.mybatis.spring.MyBatisSystemException
- 关于org.mybatis.spring.MyBatisSystemException:Parameter 'userId' not found. 错误调试
- 项目运行时报错: org.mybatis.spring.MyBatisSystemException
- org.mybatis.spring.MyBatisSystemException(参数找不到问题)
- mybatis报错:org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exception
- MyBatis批量更新报错org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.bindin
- mybatis异常:org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.B
- mybatis 异常 org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding
- 文章标题
- struts实现文件上传和下载
- linux
- python:删除.svn文件
- hadoop2.x 动态添加节点
- Java开发常见错误:org.mybatis.spring.MyBatisSystemException
- 自学 java 笔记 day6(面向对象2)
- 常见的Android优化方案
- SSH登陆问题
- 重建二叉树
- 动画帧加载过程
- java web目录层次
- 一个优秀的提交应该包含什么?
- Leet Code OJ 206. Reverse Linked List [Difficulty: Easy]