Mybatis.xml中的settings的设置
mybatis开启缓存的方法:
Mybatis.xml中的settings标签中插入
<settings>
<setting name = "cacheEnble" value="true"/>
</settings>
驼峰设置
<settings>
<!--开启下划线风格转换为驼峰风格
数据库设置采用下划线风格
Javabean采用驼峰风格
二者不匹配,所以需要开启-->
<setting name="mapUnderscoreToCamelCase" value="true"/>
</settings>
一个配置完整的 settings 元素的示例如下:
<settings>
<setting name="cacheEnabled" value="true"/>
<setting name="lazyLoadingEnabled" value="true"/>
<setting name="multipleResultSetsEnabled" value="true"/>
<setting name="useColumnLabel" value="true"/>
<setting name="useGeneratedKeys" value="false"/>
<setting name="autoMappingBehavior" value="PARTIAL"/>
<setting name="defaultExecutorType" value="SIMPLE"/>
<setting name="defaultStatementTimeout" value="25"/>
<setting name="safeRowBoundsEnabled" value="false"/>
<setting name="mapUnderscoreToCamelCase" value="false"/>
<setting name="localCacheScope" value="SESSION"/>
<setting name="jdbcTypeForNull" value="OTHER"/>
<setting name="lazyLoadTriggerMethods" value="equals,clone,hashCode,toString"/>
</settings>