iBatis 使用 OSCache 作缓存与 java.io.FileNotFoundException 异常

这种异常只会发生在 Windows 平台上,可以说是 iBatis 的一个 Bug,大约 iBatis 的开发测试人员都比较热衷于 Unix 族系的平台,而忽略了 Windows 下的兼容性测试。

出现 FileNotFoundException 异常的情形是这样的:Windows7 + iBatis2.3.0.677 + OSCache2.4.1。

iBatis 中配置使用 OSCache 缓存,在映射文件 Product.xml 中有如下声明片断:

<cacheModel type="OSCACHE" id="productCache">
    <flushOnExecute statement="Product.insert"/>
    <flushOnExecute statement="Product.delete"/>
</cacheModel>

<select id="getById" cacheModel="productCache" parameterClass="int" resultClass="Product">
    select id, name,description as desc1  from test_product where id = #value#
</select>

OSCache 的 oscache.properties 中指明用磁盘文件缓存数据,注意以下几个配置: 阅读全文 >>

类别: iBatis. 标签: , , . 阅读(145). 评论(1) »

如何在 iBatis 应用程序向 Oralce 数据表字段插入 NULL 值

用 iBatis 应用程序连接的数据库是 Oracle, 映射文件中的插入语句写成如下形式 

<!-- 插入一条Person对应的记录到数据库中 -->
<insert id="insertPerson"  parameterClass="com.unmi.Person">
    INSERT INTO PERSON(ID,NAME,PASSWD) VALUES(#id#,#name#,#passwd#)
</insert>

阅读全文 >>

类别: iBatis. 标签: , , . 阅读(304). 评论(8) »