首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

IBatis中怎么获取sqlId和传入参数对应的缓存Key值

2012-10-27 
IBatis中如何获取sqlId和传入参数对应的缓存Key值有时候我们想自己实现IBatis的缓存机制,在DAO添加缓存的

IBatis中如何获取sqlId和传入参数对应的缓存Key值

有时候我们想自己实现IBatis的缓存机制,在DAO添加缓存的方法给开发人员使用,可以通过以下的代码获取对应的Key值:

?

SqlMapClientImpl sci = (SqlMapClientImpl)this.sqlMapClient;MappedStatement ms = sci.getMappedStatement(sqlId);SessionScope sessionScope = new SessionScope();     sessionScope.incrementRequestStackDepth();     StatementScope statementScope = new StatementScope(sessionScope);     ms.initRequest(statementScope);    CacheKey key = ms.getCacheKey(statementScope, params);
?

热点排行