关于iBaits的使用
2016-04-18 15:09
447 查看
之前一直在用Hibernate,最近公司项目改换为iBatis 。所以对其进行了 小小的研究 ,再次记录一下方便下次阅读。(注意:此处是spring集成的iBatis使用)
第一步:导入Ibatis所依赖的jar包
第二步:创建ibatis对应的配置文件 、每个实体创建自己的配置,最后整合的到一个里面
第三步:在spring配置中初始化iBatis,将dataSourse及ibatis总得配置作为参数注入进去、此处引用的是SqlMapClientFactoryBean,它是SqlMapClientTemplate使用的基础
第四步:然后就是开启事物控制
第五步:代码中使用的时候实现类DAOImpl 集成 SqlMapClientDaoSupport 然后实现 自己的接口
第六步:类中的方法可以直接通过 this.getSqlMapClientTemplate().queryForList(statementName, map) 操作数据库 其中statementName为ibatis配置中起的唯一的名字,map是传入的参数。
以上只是做了简单的介绍、不够详细。
第一步:导入Ibatis所依赖的jar包
第二步:创建ibatis对应的配置文件 、每个实体创建自己的配置,最后整合的到一个里面
第三步:在spring配置中初始化iBatis,将dataSourse及ibatis总得配置作为参数注入进去、此处引用的是SqlMapClientFactoryBean,它是SqlMapClientTemplate使用的基础
第四步:然后就是开启事物控制
第五步:代码中使用的时候实现类DAOImpl 集成 SqlMapClientDaoSupport 然后实现 自己的接口
第六步:类中的方法可以直接通过 this.getSqlMapClientTemplate().queryForList(statementName, map) 操作数据库 其中statementName为ibatis配置中起的唯一的名字,map是传入的参数。
以上只是做了简单的介绍、不够详细。
相关文章推荐
- http://blog.csdn.net/jiangwei0910410003/article/details/41620363
- 1808: [Ioi2007]training 训练路径|树形DP
- vector<pair<int,int> >的插入排序,字符串中子字符串个数查找
- mysql Event Scheduler: Failed to open table mysql.event
- 在AIX环境下解压tar.gz文件报错tar: Not a recognized flag: z
- SMTP Error: The following recipients failed
- Dell做RAID配置图文全教程
- Leetcode - Climbing Stairs
- 响应者链(Responder Chain)
- Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default- comp
- error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
- Caused by: com.mongodb.CommandFailureException: { "serverUsed" : "127.0.0.1:27017" , "errmsg" :
- Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (default-compile
- You are installing software that contain unsigned content and authenticity and validity of this soft
- 解决 Target failed to run: Permission to debug con.cyt.tableview was denied.
- Failed to execute goal org.apache.maven.plugins
- 使用AIDL远程调用服务中的方法
- ceph 性能监控calamair在ubuntu14.04上的安装部署
- [LeetCode]-011-Container_With_Most_Water
- svn报错cleanup failed–previous operation has not finished; run cleanup if it was interrupted的解决办法