SSM-Mybatis learning record (4)

1. Lazy loading in Mybatis (XML file configuration)

1. Lazy loading and immediate loading

Insert picture description here
Lazy loading
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
Lazy loading (2)
Insert picture description here
Insert picture description here
Insert picture description here

Second, the cache in Mybatis

	什么是缓存
	为什么使用缓存
	什么样的数据能够使用缓存,什么样的数据不能使用
	Mybatis中的一级缓存和二级缓存
		一级缓存:缓存的是对象
		二级缓存:缓存的是数据而不是对象

The first-level cache is the cache of the SqlSession range. When calling SqlSession to modify, add, or delete,
Insert picture description here
1. Use the secondary cache
Insert picture description here
2. Under the main configuration file
Insert picture description here
Insert picture description here

Through the cache, when the id of the two queries is the same as the first, the cache is read the second time,
and the data is taken out, which improves the efficiency of reading. The final output is still false

Published 12 original articles · Liked3 · Visits 407

Guess you like

Origin blog.csdn.net/Hobo_hua/article/details/104020610