# mybatis **Repository Path**: taylorswift_meimie/mybatis ## Basic Information - **Project Name**: mybatis - **Description**: 学习MyBatis框架 - **Primary Language**: Java - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-01-11 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # MyBatis #### 学习大纲 1. MyBatis介绍 2. MyBatis入门案例-XMl配置 3. MyBatis入门案例-注解配置 4. MyBatis参数和返回值结果 5. MyBatis连接池和事务 6. MyBatis多表查询 7. MyBatis延迟加载 8. MyBatis缓存 9. MyBatis注解开发 #### MyBatis介绍 1. 持久层框架,内部封装了JDBC,采用ORM思想,使开发者只关注sql语句本身 #### 入门-XML配置 创建的位置在resource下: 使用: //1.读取配置文件 InputStream in = Resources.getResourceAsStream("SqlMapConfig.xml"); //2.创建 SqlSessionFactory 的构建者对象 SqlSessionFactoryBuilder builder = new SqlSessionFactoryBuilder(); //3.使用构建者创建工厂对象 SqlSessionFactory SqlSessionFactory factory = builder.build(in); //4.使用 SqlSessionFactory 生产 SqlSession 对象 SqlSession session = factory.openSession(); //5.使用 SqlSession 创建 dao 接口的代理对象 IUserDao userDao = session.getMapper(IUserDao.class); //6.使用代理对象执行查询所有方法 List users = userDao.findAll(); for(User user : users) { System.out.println(user); } //7.释放资源 session.close(); in.close(); #### 使门-注解配置 Dao方法上: @Select("select * from user;") List findAll(); #### 参与贡献 1. Fork 本仓库 2. 新建 Feat_xxx 分支 3. 提交代码 4. 新建 Pull Request #### 码云特技 1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md 2. 码云官方博客 [blog.gitee.com](https://blog.gitee.com) 3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解码云上的优秀开源项目 4. [GVP](https://gitee.com/gvp) 全称是码云最有价值开源项目,是码云综合评定出的优秀开源项目 5. 码云官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) 6. 码云封面人物是一档用来展示码云会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)