ibatis操作clob字段(oracle9i,ibatis2.3)

来源:互联网 发布:分层图算法 编辑:程序博客网 时间:2024/06/05 03:19

1、读取:

     通过升级oracle驱动库到10g或以上,clob字段即可按普通的String字段读取;定义时property定义为String即可;

2、写入:

     如果只升级驱动,发现对于某些长度不支持,如1000-1500汉字,会在插入时报错ORA-4183错误。解决方法:更新时指定TypeHandler接口

    update news
      set title = #title#, type=#type#, issued=#issued#,
          newspic=#newsPic#, content=#content,handler=org.springframework.orm.ibatis.support.ClobStringTypeHandler#
    where id = #id#

 

    具体可以上网搜索“content=#content,handler=org.springframework.orm.ibatis.support.ClobStringTypeHandler#” 即可找到不少相关的文章