问题描述:
如何将平台中现有的使用spring创建出的sqlMap的SessionStore处理成多线程?
解决方案:
1. 新建一个类HybridSqlMapFactory,继承Baosight.Platform.Data.IBatis.SqlMapperFactoryObject。然后在里面重写创建实例的方法 public override object CreateInstance() { varsqlmap=(ISqlMapper)this; if(sqlmap!=null) { sqlmap.SessionStore = newIBatisNet.DataMapper.SessionStore.HybridWebThreadSessionStore(sqlmap.Id); } }
2. 修改spring配置 找到位于网站目录/SpringFramework/applicationContext-db.xml文件,将里面的 <object id="sqlMap"type="Baosight.Platform.Data.IBatis.SqlMapperFactoryObject,Baosight.Platform.Data.IBatis"> <property name="Config"value="~/SqlMap.config" /> </object>进行修改,将type修改为type="xx.xx.xx.HybridSqlMapFactory,xx.xx.xx"。
经过上述两步,即可解决问题。

