Mybatis中二级缓冲设置步骤
在mybatiss中打开全局配置文件.在xml文件中设置,默认为truee <settings> <setting name="cacheEnabled" value="false"/> </settings>2.添加到mapper文件中:
<cache>或<cached-ref>3.在select语句中配置usecache=true,默认为true
<select id="selectPage" resultMap="usersMap" useCache="true">4.实体类需要实现Serializable的序列接口
public class User implements Serializable { private int id; private String userName; private String password;}