会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
Arbitrary233
博客园
首页
新随笔
联系
订阅
管理
上一页
1
···
23
24
25
26
27
28
29
30
下一页
2020年2月26日
23、mybatis学习——mybatis的二级缓存
摘要: MyBatis 一级缓存最大的共享范围就是一个SqlSession内部,那么如果多个 SqlSession 需要共享缓存,则需要开启二级缓存,开启二级缓存后,会使用 CachingExecutor 装饰 Executor,进入一级缓存的查询流程前,先在CachingExecutor 进行二级缓存的查
阅读全文
posted @ 2020-02-26 00:10 Arbitrary233
阅读(267)
评论(0)
推荐(0)
2020年2月25日
22、mybatis学习——mybatis的一级缓存
摘要: /*测试一级缓存(本地缓存):sqlSession的缓存级别。一级缓存是一直开启的 * 与数据库同一次会话期间查询到的数据会放在本地缓存中。 * 以后如果需要获取相同的数据,直接从缓存中拿,不需要再去查数据库; * * 一级缓存失效情况: * 1、sqlSession不同 * 2、sqlSessio
阅读全文
posted @ 2020-02-25 21:53 Arbitrary233
阅读(191)
评论(0)
推荐(0)
21、mybatis学习——mybatis动态sql之<sql>抽取sql语句
摘要: StudentMapper中的配置 抽取的sql用<sql>标签;属性id即该sql的唯一标识 需要引用时使用<include>标签;属性refid填写要引用sql的id <!-- 通过foreach批量插入数据 --> <insert id="insertStusByForeach"> inser
阅读全文
posted @ 2020-02-25 17:24 Arbitrary233
阅读(794)
评论(0)
推荐(0)
20、mybatis学习——<bind>绑定
摘要: <select id="getStuByTrim" resultType="student"> select * from student <!-- 绑定参数拼接字符串 --> <bind name="stuName" value="'%'+name+'%'"/> <trim prefix="whe
阅读全文
posted @ 2020-02-25 17:12 Arbitrary233
阅读(257)
评论(0)
推荐(0)
19、mybatis学习——mybatis的动态sql之<foreach>遍历传入的数组,集合和map
摘要: foreach元素的属性主要有item,index,collection,open,separator,close。 item:集合中元素迭代时的别名,该参数为必选。 index:在list和数组中,index是元素的序号,在map中,index是元素的key,该参数可选 open:foreach代
阅读全文
posted @ 2020-02-25 13:52 Arbitrary233
阅读(3357)
评论(0)
推荐(0)
18、mybatis学习——mybatis的动态sql之通过{<set>和<if>结合}或者{<trim>和<if>的结合}实现部分字段更新
摘要: Student.java StudentMapper接口定义方法 StudentMapper配置文件进行相应配置 方式一(<set>和<if>结合) <update id="updateStu"> update student <!-- set会去掉拼接后的字符串多余的(逗号), 比如只修改id时则
阅读全文
posted @ 2020-02-25 00:26 Arbitrary233
阅读(973)
评论(0)
推荐(0)
17、mybatis学习——mybatis的动态sql之<choose><when><otherwise>选择唯一条件
摘要: StudentMapper接口中定义方法 StudentMapper配置文件进行相应的配置(这里没有写<otherwise>标签,接在<when>标签即可) <select id="getStuByChoose" resultType="student"> select * from student
阅读全文
posted @ 2020-02-25 00:05 Arbitrary233
阅读(429)
评论(0)
推荐(0)
2020年2月24日
16、mybatis学习——mybatis的动态sql之<if>、<where>和<trim>
摘要: Student.java: StudentMapper接口定义方法: StudentMapper配置文件进行配置 <select id="getStuByIf" resultType="student"> select * from student where <!-- test:判断表达式;里面使
阅读全文
posted @ 2020-02-24 22:22 Arbitrary233
阅读(543)
评论(0)
推荐(0)
2020年2月23日
15、mybatis学习——鉴别器discriminator的使用
摘要: 这个例子只是重在为了理解discriminator的使用 一对多的实体类Student.java 多对一的实体类College.java StudentMapper接口定义测试discriminator的方法 StudentMapper的sql配置文件中进行相对应接口方法配置 <!-- 测试鉴别器d
阅读全文
posted @ 2020-02-23 18:20 Arbitrary233
阅读(888)
评论(0)
推荐(0)
14、mybatis学习——分布查询association或collection中多列值传参 以及 局部方法延迟加载问题
摘要: 举例注释中说明: <collection property="students" select="com.pxxy.bean.StudentMapper.getStusByColId" column="id" fetchType="lazy"> <!-- 多列值传递时:将多列的值封装成map进行传递
阅读全文
posted @ 2020-02-23 17:01 Arbitrary233
阅读(390)
评论(0)
推荐(0)
上一页
1
···
23
24
25
26
27
28
29
30
下一页
公告