最近使用IBATIS,运用到了CACHEMODEL
异常如下:
/SqlMapConfig.xml/end() there are no statement named abatorgenerated_deleteByPrimaryKey .
SQLMAPCONFIG。XML文件设置如下:
<settings
cacheModelsEnabled="true"
enhancementEnabled="true"
lazyLoadingEnabled="true"
maxRequests="128"
maxSessions="100"
maxTransactions="5"
useStatementNamespaces="true"
defaultStatementTimeout="5"
statementCachingEnabled="true"
classInfoCacheEnabled="true"
errorTracingEnabled="true"
/>
<sqlMap resource="com/ytx/ztc/model/sqlmap/ft_bet_team_SqlMap.xml"/>
在其运用的XML中配置如下:
ft_bet_team_SqlMap.xml
<cacheModel type="LRU" id="cache_oddsproviderlist" readOnly="true" serialize="true">
<flushInterval hours="24"></flushInterval>
<flushOnExecute statement="odds_provider.abatorgenerated_deleteByPrimaryKey"/>
<flushOnExecute statement="odds_provider.abatorgenerated_deleteByExample"/>
<flushOnExecute statement="odds_provider.abatorgenerated_insert"/>
<flushOnExecute statement="odds_provider.abatorgenerated_updateByPrimaryKey"/>
<flushOnExecute statement="odds_provider.abatorgenerated_updateByPrimaryKeySelective"/>
<property value="cache-size" name="200"/>
</cacheModel>
<select id="getPageOddsProviderList" parameterClass="com.ytx.ztc.model.OddsProvider" resultMap="abatorgenerated_OddsProviderResult">
select * from ft_bet_team
</select>
原因是cacheModel 运行的语句,不能自动加上空间域名。必须手动的添加。如
<flushOnExecute statement="abatorgenerated_deleteByPrimaryKey"/>
上面的就会报找不到这条语句。加上空间名后。如下就没有这个问题了。
<flushOnExecute statement="odds_provider.abatorgenerated_deleteByPrimaryKey"/>
这个问题解决后。但是遇到缓存不起作用??
我第一次把数据查询完成后,有第一次查询的结果集中,通过后台数据库“偷偷”的删除其中一条。
如果缓存应用成功的话,那么会如前一次查询一样,显示出来。
但结果是查询出来的结果里面没有这条记录了??难道我哪个地方配置有误???
现在问题已经解决。。。。原因是在cacheModel 语句的ID中要手动添加空间名。但是在SqlMapConfig.xml
中配置的.也就是说这个 cacehModel是相对全局来说的。而不像XML中的DDL语句.
statementCachingEnabled="true"
不管用了??
分享到:
相关推荐
ibatis 使用手册:ibatis 开发指南、ibatis sql maps、ibatis sql maps 入门教程。
ibatis 相关使用文档及安装包ibatis 相关使用文档及安装包
ibatis简易使用ibatis简易使用ibatis简易使用
使用Ibatis对数据库的访问,实现增删改查的操作 ;
ibatis教程 主要是对这个软件的入门的介绍和如何加载和使用
ibatis学习 ibatis总结 ibatis ibatis ibatis
ibatis适用手册,快速掌握ibatis
ibatis资料ibatis资料ibatis资料ibatis资料ibatis资料ibatis资料ibatis资料ibatis资料ibatis资料
包括ibatis开发的基础教程,以及ibatis在eclipse、myeclipse中搭建开发环境的详细步骤。
ibatis使用指南
Ibatis3,手册,Ibatis3手册,Ibatis3使用手册,Ibatis3参考手册
ibatis demo,ibatis例子,ibatis示例
ibatis 使用简单配置
iBATIS 级联iBATIS 级联iBATIS 级联
IBatis.Net详细使用手册
iBATIS缓存的使用方法
ibatis
ibatis的原码 ibatis源码 ibatis源码 ibatis源码
他们也阐明了怎样取得你已编写的SQL语句及把他们映射给iBATIS使用的Bean。最后,还讨论了iBATIS的优缺点,及为什么是这样的一种方式,即所谓的“在完全OR与JDBC之间的一个幽雅的折衷。” <br>就象Developer's ...
iBatis.Net详细使用手册,好东西共享下。