hibernate3.6.10版本如何操作oracle的大字段clob?

以前代码使用hibernate3.x较低版本实现,如下:

            // 更新之前先对blob字段进行初始化
           
            trackList.setInputParam(Hibernate.createClob(" "));
            trackList.setOutputParam(Hibernate.createClob(" "));
           
            // 对于有Clob字段的pojo保存,需要单独写保存方法
            getHibernateTemplate().save(trackList);
            getHibernateTemplate().flush();
           
            if (GeneralTools.isNull(trackList.getInputParamString()))
            {
                trackList.setInputParamString(" ");
            }
            if (GeneralTools.isNull(trackList.getOutputParamString()))
            {
                trackList.setOutputParamString(" ");
            }
            // 锁定表数据
           
            getHibernateTemplate().refresh(trackList, LockMode.UPGRADE);
           
            // 获取Input Clob字段
            SerializableClob inputSc = (SerializableClob)trackList.getInputParam();
            Clob inputWrapclob = inputSc.getWrappedClob();
            // 转为为oracle类型的CLOB
            CLOB inputClob = (CLOB)inputWrapclob;
           
            // 获取字符输出流
           
            wInput = inputClob.getCharacterOutputStream();
            // 写数据到数据库
           
            wInput.write(trackList.getInputParamString());
            // 同步缓存到数据库
            wInput.flush();
           
            // 获取Output clob字段
            SerializableClob outputSc = (SerializableClob)trackList.getOutputParam();
            Clob outputWrapclob = outputSc.getWrappedClob();
            // 转为为oracle类型的CLOB
            CLOB outputClob = (CLOB)outputWrapclob;
           
            // 获取字符输出流
           
            wOutput = outputClob.getCharacterOutputStream();
            // 写数据到数据库
           
            wOutput.write(trackList.getOutputParamString());
            // 同步缓存到数据库
            wOutput.flush();
        }
       

由于hibernate3.6.10中没有SerializableClob,应该如何​操作,请各位大侠帮忙????

你可能感兴趣的:(hibernate3)