use of com.jfinal.plugin.activerecord.CaseInsensitiveContainerFactory in project jboot by yangfuhai.
the class ArpManager method configDialect.
/**
* 配置 数据源的 方言
*
* @param activeRecordPlugin
* @param datasourceConfig
*/
private void configDialect(ActiveRecordPlugin activeRecordPlugin, DataSourceConfig datasourceConfig) {
if (datasourceConfig.getDialectClass() != null) {
Dialect dialect = ClassUtil.newInstance(datasourceConfig.getDialectClass(), false);
if (dialect == null) {
throw new NullPointerException("can not new instance by class:" + datasourceConfig.getDialectClass());
}
activeRecordPlugin.setDialect(dialect);
return;
}
switch(datasourceConfig.getType()) {
case DataSourceConfig.TYPE_MYSQL:
activeRecordPlugin.setDialect(new JbootMysqlDialect());
break;
case DataSourceConfig.TYPE_ORACLE:
if (StrUtil.isBlank(datasourceConfig.getContainerFactory())) {
activeRecordPlugin.setContainerFactory(new CaseInsensitiveContainerFactory());
}
activeRecordPlugin.setDialect(new JbootOracleDialect());
break;
case DataSourceConfig.TYPE_SQLSERVER:
activeRecordPlugin.setDialect(new JbootSqlServerDialect());
break;
case DataSourceConfig.TYPE_SQLITE:
activeRecordPlugin.setDialect(new JbootSqlite3Dialect());
break;
case DataSourceConfig.TYPE_ANSISQL:
activeRecordPlugin.setDialect(new JbootAnsiSqlDialect());
break;
case DataSourceConfig.TYPE_POSTGRESQL:
activeRecordPlugin.setDialect(new JbootPostgreSqlDialect());
break;
case DataSourceConfig.TYPE_CLICKHOUSE:
activeRecordPlugin.setDialect(new JbootClickHouseDialect());
break;
case DataSourceConfig.TYPE_INFORMIX:
activeRecordPlugin.setDialect(new JbootInformixDialect());
break;
default:
throw new JbootIllegalConfigException("only support datasource type : mysql、orcale、sqlserver、sqlite、ansisql、postgresql and clickhouse, please check your jboot.properties. ");
}
}
Aggregations