CLOB Persistent Source in 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 ();
}
Then the CLOB in the Orcale is mapped to what type hiberbate the. hbm.xml file and the class in Pojo.
In my program, Pojo is a string type and. Hbm.xml corresponds to text in the database for the CLOB is a way to read on the Internet
And I run the program appears 80781 [http-8080-1] WARN util. Jdbcexceptionreporter-sql error:17090, Sqlstate:null
80781 [http-8080-1] ERROR util. Jdbcexceptionreporter-Operation not allowed: streams type cannot is used in batching
80796 [Http-8080-1] ERROR def. Abstractflushingeventlistener-could not synchronize Database
Org.hibernate.exception.GenericJDBCException:could not insert: [ Com.viceasy.wlhk.information.bean.NewsPublicNotice]
With this drive Ojdbc14.jar the CLOBL type in the database is mapped to the text type in the. hbm.xml
Pojo is string type but in. hbm.xml add a length= "100000"
It's okay.