接下来,就是配置项如何影响Configuration的值了。
---未完待续
private void settingsElement(Properties props) throws Exception {
//设置autoMappingBehavior,默认为PARTIAL
configuration.setAutoMappingBehavior(
AutoMappingBehavior.valueOf(props.getProperty("autoMappingBehavior", "PARTIAL")));
//设置autoMappingUnknownColumnBehavior,默认为NONE
configuration.setAutoMappingUnknownColumnBehavior(AutoMappingUnknownColumnBehavior
.valueOf(props.getProperty("autoMappingUnknownColumnBehavior", "NONE")));
//设置cacheEnabled,默认为true
configuration.setCacheEnabled(booleanValueOf(props.getProperty("cacheEnabled"), true));
//设置proxyFactory为new JavassistProxyFactory()
configuration.setProxyFactory((ProxyFactory) createInstance(props.getProperty("proxyFactory")));
//设置lazyLoadingEnabled为false
configuration.setLazyLoadingEnabled(booleanValueOf(props.getProperty("lazyLoadingEnabled"), false));
//设置aggressiveLazyLoading为false
configuration.setAggressiveLazyLoading(booleanValueOf(props.getProperty("aggressiveLazyLoading"), false));
//设置multipleResultSetsEnabled为true
configuration
.setMultipleResultSetsEnabled(booleanValueOf(props.getProperty("multipleResultSetsEnabled"), true));
//
//
//设置useColumnLabel为true
configuration.setUseColumnLabel(booleanValueOf(props.getProperty("useColumnLabel"), true));
//设置useGeneratedKeys为false
configuration.setUseGeneratedKeys(booleanValueOf(props.getProperty("useGeneratedKeys"), false));
//设置defaultExecutorType为SIMPLE
configuration.setDefaultExecutorType(ExecutorType.valueOf(props.getProperty("defaultExecutorType", "SIMPLE")));
//设置defaultStatementTimeout为null
configuration.setDefaultStatementTimeout(integerValueOf(props.getProperty("defaultStatementTimeout"), null));
//设置defaultFetchSize为null
configuration.setDefaultFetchSize(integerValueOf(props.getProperty("defaultFetchSize"), null));
//设置mapUnderscoreToCamelCase为false
configuration.setMapUnderscoreToCamelCase(booleanValueOf(props.getProperty("mapUnderscoreToCamelCase"), false));
//设置safeRowBoundsEnabled为false
configuration.setSafeRowBoundsEnabled(booleanValueOf(props.getProperty("safeRowBoundsEnabled"), false));
//设置localCacheScope为SESSION
configuration.setLocalCacheScope(LocalCacheScope.valueOf(props.getProperty("localCacheScope", "SESSION")));
//
//设置jdbcTypeForNull为OTHER
configuration.setJdbcTypeForNull(JdbcType.valueOf(props.getProperty("jdbcTypeForNull", "OTHER")));
//设置lazyLoadTriggerMethods为4个函数
configuration.setLazyLoadTriggerMethods(
stringSetValueOf(props.getProperty("lazyLoadTriggerMethods"), "equals,clone,hashCode,toString"));
//设置safeResultHandlerEnabled为true
configuration.setSafeResultHandlerEnabled(booleanValueOf(props.getProperty("safeResultHandlerEnabled"), true));
//
//
//设置defaultDriverClass为XmlLanguageDrier.class
configuration.setDefaultScriptingLanguage(resolveClass(props.getProperty("defaultScriptingLanguage")));
//
//设置callSettersOnNulls为false
configuration.setCallSettersOnNulls(booleanValueOf(props.getProperty("callSettersOnNulls"), false));
//设置useActualParamName为true
configuration.setUseActualParamName(booleanValueOf(props.getProperty("useActualParamName"), true));
//设置returnInstanceForEmptyRow为false
configuration
.setReturnInstanceForEmptyRow(booleanValueOf(props.getProperty("returnInstanceForEmptyRow"), false));
//设置logPrefix的值
configuration.setLogPrefix(props.getProperty("logPrefix"));
@SuppressWarnings("unchecked")
//继续
//
//设置LogImpl,前提是非空
Class<? extends Log> logImpl = (Class<? extends Log>) resolveClass(props.getProperty("logImpl"));
configuration.setLogImpl(logImpl);
//设置configurationFactory,默认为null
configuration.setConfigurationFactory(resolveClass(props.getProperty("configurationFactory")));
//结束
}