Orcale 中的CLOB字段的处理,hibernate处理clob
来源:互联网 发布:php全能运行环境 编辑:程序博客网 时间:2024/05/17 23:22
clob 在oracle中的持久化源码:
public void AddClob(String AsTable, String fieldName, String id,
String values) throws Exception {
PrimaryKey = "ID";
String strSQL = "SELECT " + fieldName + " FROM " + AsTable + " WHERE "
+ PrimaryKey + "='" + id + "' FOR UPDATE";
String updateSQL = "update " + AsTable + " set " + fieldName
+ "=empty_clob() where " + PrimaryKey + "='" + id + "' and "
+ fieldName + " is null";
System.out.println("strSQL="+strSQL);
System.out.println("updateSQL="+updateSQL);
Statement ps = conn.createStatement();
ps.executeUpdate(updateSQL);
oracle.sql.CLOB clob = null;
this.conn.setAutoCommit(false);
ResultSet rs = stmt.executeQuery(strSQL);
if (rs.next()) {
clob = (CLOB) rs.getClob(1);
Writer outStream = clob.getCharacterOutputStream();
char[] c = values.toCharArray();
outStream.write(c, 0, c.length);
outStream.flush();
outStream.close();
}
this.conn.commit();
}
那么Orcale 中的CLOB 在hiberbate 的.hbm.xml 文件和在pojo的类映射成什么类型 ?
我的程序中pojo是String 类型 而 .hbm.xml 对应的映射为text 在数据库里为CLOB 者是在网上看到的 一种写法
而我运行程序出现 80781 [http-8080-1] WARN util.JDBCExceptionReporter - SQL Error: 17090, SQLState: null
80781 [http-8080-1] ERROR util.JDBCExceptionReporter - 不允许的操作: streams type cannot be used in batching
80796 [http-8080-1] ERROR def.AbstractFlushingEventListener - Could not synchronize database state with session
org.hibernate.exception.GenericJDBCException: could not insert: [com.viceasy.wlhk.information.bean.NewsPublicNotice]
用这个驱动ojdbc14.jar 在数据库为clobl类型 在.hbm.xml映射为text类型
pojo里为String类型 但是在 .hbm.xml 加个length="100000"
就可以了
- Orcale 中的CLOB字段的处理,hibernate处理clob
- hibernate 处理 Clob字段
- 对clob字段的处理
- hibernate clob/blob的处理
- hibernate+spring处理BLOB,CLOB字段
- Spring+hibernate对clob、blob字段的处理方法
- spring+hibernate中clob、blob字段的处理方法
- java处理CLOB字段
- JAVA CLOB字段处理
- oracle clob字段处理
- HIVE CLOB字段处理
- oracle中的clob字段的回车换行的处理
- hibernate中clob处理
- hibernate中clob处理
- hibernate中clob处理
- hibernate处理clob
- hibernate中oracle 中的clob处理 .
- 数据转触时clob字段的处理办法
- bboss persistent 1.0.3 发布,功能变更清单见正文
- linux学习笔记
- 【转帖】vc 线程
- SQL调优公式T=S/V
- JavaScript获取GridView中用户点击控件的行号,列号
- Orcale 中的CLOB字段的处理,hibernate处理clob
- asp中,[收藏本页]的代码怎么写
- 一个网站上设置"设为主页"和"加入收藏夹"的代码
- 严重鄙视自己
- 天天刷 pv值 工具
- PHP文件上传
- 编译内核模块
- 我国将对部分信息安全产品强制认证 智能卡COS
- Delphi实现下载进程的动态显示