hibernate中如何处理ORACLE大字段 需要在hbm.xml配置文件的blob属性上加上type属性<property name="xxx" type="blob">这样,hibernate会用不同于其他字段的方式处理这个字段 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 对csdn有点失望问题已已经解决比较兴奋楼上的谢谢留言结贴 问题是怎么解决的?能否share一下! public static void saveReceiveMail(Receivemail receivemail,byte[] content) throws DAOException { BaseDAO dao = new BaseDAO(); try { Session session = dao.getSession(); Transaction tx = session.beginTransaction(); byte[] buffer = new byte[1]; buffer[0] = 1; receivemail.setFilecontent(Hibernate.createBlob(buffer) ); session.save(receivemail); session.flush(); session.refresh(receivemail, LockMode.UPGRADE); SerializableBlob blob = (org.hibernate.lob.SerializableBlob)receivemail.getFilecontent(); Blob wb = blob.getWrappedBlob(); if (wb instanceof BLOB) { BLOB image = (BLOB) wb; OutputStream out = image.getBinaryOutputStream(); out.write(content, 0, content.length); //这里自己改成你的数据 out.flush(); out.close();} tx.commit(); session.close(); }catch (SQLException e) { throw new DAOException(e, "查找数据失败!"); } catch (IOException e) { throw new DAOException(e, "数据传输失败!"); } } 4k以上做特殊处理bolb类型的先插入空的在更新进去就好了的 学spring时对getBean方法的疑问 jquery+struts2 $.post()提交到指定action方法错误 一个JDK的安装问题。。。愁死我了 jbpm异常,findLatestProcessDefinition就教了。谢谢 spring的事务管理机制 使用FCKeditor出错了,请高人指点迷津! 很奇怪的一个struts的问题,郁闷死了,请高手帮忙(急~~) 请教一个JdbcOdbcDriver比较初级的问题。 如何看到JAVA源代码 怎么在已有的SSH项目中开发第三方接口,新手求指导 学习JSP前一定要先学XML吗? jsp新手问题求助
问题已已经解决
比较兴奋
楼上的谢谢留言
结贴
BaseDAO dao = new BaseDAO();
try {
Session session = dao.getSession();
Transaction tx = session.beginTransaction();
byte[] buffer = new byte[1];
buffer[0] = 1;
receivemail.setFilecontent(Hibernate.createBlob(buffer) );
session.save(receivemail);
session.flush();
session.refresh(receivemail, LockMode.UPGRADE);
SerializableBlob blob = (org.hibernate.lob.SerializableBlob)receivemail.getFilecontent();
Blob wb = blob.getWrappedBlob();
if (wb instanceof BLOB) {
BLOB image = (BLOB) wb;
OutputStream out = image.getBinaryOutputStream();
out.write(content, 0, content.length); //这里自己改成你的数据 out.flush();
out.close();}
tx.commit();
session.close();
}catch (SQLException e) {
throw new DAOException(e, "查找数据失败!");
} catch (IOException e) {
throw new DAOException(e, "数据传输失败!");
}
}
bolb类型的
先插入空的在更新进去
就好了的