摘要: Sample CodeJPetStore 6 is a full web application built on top of MyBatis 3, Spring 3 and Stripes. It is available for downloading in the downloads sec... 阅读全文
posted @ 2015-01-15 13:44 何石-博客 阅读(352) 评论(0) 推荐(0) 编辑
摘要: 使用 MyBatis-Spring,你可以继续直接使用 MyBatis 的 API。仅仅在代码中使用 Spring 中的 SqlSessionFactoryBean 来创建一个 SqlSessionFactory。public class UserMapperSqlSessionImpl imple... 阅读全文
posted @ 2015-01-15 13:43 何石-博客 阅读(319) 评论(0) 推荐(0) 编辑
摘要: 在 MyBatis 中,你可以使用 SqlSessionFactory 来创建 SqlSession。一旦你获得一个 session 之后,你可以使用它来执行映射语句,提交或回滚连接,最后,当不再需要它的时候, 你可以关闭 session。使用 MyBatis-Spring 之后, 你不再需要直接使... 阅读全文
posted @ 2015-01-15 13:42 何石-博客 阅读(712) 评论(0) 推荐(0) 编辑
摘要: 一个使用 MyBatis-Spring 的主要原因是它允许 MyBatis 参与到 Spring 的事务管理中。而不是给 MyBatis 创建一个新的特定的事务管理器,MyBatis-Spring 利用了存在于 Spring 中的 DataSourceTransactionManager。一旦 Sp... 阅读全文
posted @ 2015-01-15 13:41 何石-博客 阅读(332) 评论(0) 推荐(0) 编辑
摘要: SqlSessionFactoryBean在基本的 MyBatis 中,session 工厂可以使用 SqlSessionFactoryBuilder 来创建。而在 MyBatis-Spring 中,则使用 SqlSessionFactoryBean 来替代。Setup要创建工厂 bean,放置下面... 阅读全文
posted @ 2015-01-15 13:39 何石-博客 阅读(920) 评论(0) 推荐(0) 编辑
摘要: 本章将会以简略的步骤告诉你如何安装和创建 MyBatis-Spring,并构建一个简单的数据访问事务性的应用程序。Installation要使用 MyBatis-Spring 模块,你只需要包含 mybatis-spring-x.x.x.jar 文 件就可以了,并在类路径中加入相关的依赖。如果你使用... 阅读全文
posted @ 2015-01-15 13:38 何石-博客 阅读(171) 评论(0) 推荐(0) 编辑
摘要: What is MyBatis-Spring?MyBatis-Spring 会帮助你将 MyBatis 代码无缝地整合到 Spring 中。使用这个类库中的类, Spring 将会加载必要的 MyBatis 工厂类和 session 类。这个类库也提供一个简单的方式来注入 MyBatis 数据映射器... 阅读全文
posted @ 2015-01-15 13:37 何石-博客 阅读(238) 评论(0) 推荐(0) 编辑
摘要: 为了代替手工使用 SqlSessionDaoSupport 或 SqlSessionTemplate 编写数据访问对象 (DAO)的代码,MyBatis-Spring 提供了一个动态代理的实现:MapperFactoryBean。这个类可以让你直接注入数据映射器接口到你的 service 层 bea... 阅读全文
posted @ 2015-01-15 13:33 何石-博客 阅读(608) 评论(0) 推荐(0) 编辑