Mybatis
Thxxxxxx
然鹅我不想简介自己
展开
-
Mybatis简约执行过程
SqlsessionFactory sqlsessionFactory=getSqlsessionFactory();SqlSession openSession =sqlsessionFactory.openSession();EmployeeMapper mapper=openSession.getMapper(EmployeeMapper.class); //获得代理对象Em...原创 2019-06-20 15:35:49 · 127 阅读 · 0 评论 -
Mybatis的全局配置文件中的标签
先来看下整体结构图如下: propertise使用properties来引入外部properties配置文件的内容。 resource:引入类路径下的资源 url:引入网络路径或者磁盘路径下的资源<properties resource="dbcon...原创 2019-06-20 18:30:19 · 1000 阅读 · 0 评论 -
Mysql和Oracle获取自增主键
mysql<!-- parameterType:参数类型,可以省略, 获取自增主键的值: mysql支持自增主键,自增主键值的获取,mybatis也是利用statement.getGenreatedKeys(); useGeneratedKeys="true";使用自增主键获取主键值策略 keyProperty;指定对应的主键属性...转载 2019-06-20 19:44:55 · 340 阅读 · 1 评论 -
@Param
Mapper.class中有个接口方法public User getUserByIdandName(Integer id,String name);Mapper.xml<select id="getUserByIdandName" resultType="user">select * from user where id=#{param0} and name=#{p...原创 2019-06-20 20:00:11 · 2138 阅读 · 0 评论 -
Mybatis的缓存
一级缓存: (本地缓存):sqlSession级别的缓存。一级缓存是一直开启的;SqlSession级别的一个Map 与数据库同一次会话期间查询到的数据会放在本地缓存中。 以后如果需要获取相同的数据,直接从缓存中拿,没必要再去查询数据库; 一级缓存失效情况(没有使用到当前一级缓存的情况...转载 2019-06-22 19:26:50 · 127 阅读 · 0 评论 -
Mybatis查询执行流程
String resource = "mybatis-config.xml";InputStream inputStream = Resources.getResourceAsStream(resource);SqlSessionFactory sqlSessionFactory =new SqlSessionFactoryBuilder().build(inputStream);Sql...转载 2019-06-24 11:06:16 · 186 阅读 · 0 评论