jfinal5.1.9版本,启动类中配置了多个数据源,将最后一个数据源配置属性名(字段名)大小写不敏感,结果导致从前一个数据源获取数据时,属性字段也变小写了。
setContainerFactory()这个设置是全局生效的吗?请教下这个该如何调整数据源各自的设置互不影响? @JFinal
代码如下:
public void configPlugin(Plugins me) { ... //模板库 DruidPlugin druidPluginDw = getDruidPluginDw(); druidPluginDw.addFilter(wallFilter); druidPluginDw.addFilter(new StatFilter()); me.add(druidPluginDw); ActiveRecordPlugin arpDw = new ActiveRecordPlugin(Const.DWDBID_TEMP, druidPluginDw); arpDw.setTransactionLevel(Connection.TRANSACTION_READ_COMMITTED); _MappingKitDw.mapping(arpDw); me.add(arpDw); arpDw.setShowSql(p.getBoolean("showSql", false)); arpDw.getEngine().setToClassPathSourceFactory(); //公用库 DruidPlugin druidPluginDc = getDruidPluginDc(); druidPluginDc.addFilter(wallFilter); druidPluginDc.addFilter(new StatFilter()); me.add(druidPluginDc); ActiveRecordPlugin arpDc = new ActiveRecordPlugin(Const.DCDBID_DATA, druidPluginDc); arpDc.setTransactionLevel(Connection.TRANSACTION_READ_COMMITTED); // 这句代码会导致从上边“模板库”获取数据时,属性字段名都变成小写了 ??? arpDc.setContainerFactory(new CaseInsensitiveContainerFactory(true)); //_MappingKitDc.mapping(arpDc); me.add(arpDc); arpDc.setShowSql(p.getBoolean("showSql", false)); arpDc.getEngine().setToClassPathSourceFactory(); ... }
改为
new CaseInsensitiveContainerFactory()
即可
如果希望转成大写,改为
new CaseInsensitiveContainerFactory(false)