`
sshzhangwg
  • 浏览: 68998 次
  • 性别: Icon_minigender_1
  • 来自: 长沙
社区版块
存档分类
最新评论

MyBatis3使用小结

    博客分类:
  • Java
 
阅读更多

   使用mybatis3-spring进行数据库操作时,出现下面的异常:

 Exception in thread "main" java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for org.test.dao.TMpUserMapper.insert

 

   经过分析和实践,发现将TMpUserMapper.xml拷贝到dao.TMpUserMapper类所在的包下后,即使不在Configuration.xml中配置TMpUserMapper.xml的路径,也是可以的。这是因为mybatis-spring这个插件已经将ibatis的配置简化到最低,只需要配置applicationContext.xml即可,不需要理会mybatis的配置。

 

  归纳起来,1) 使用 mybatis-generator 生成vo、mapper、sample    2) 配置 applicationContext.xml

简单的CRUD基本上不需要写代码。

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics