java一:
voTShizhengRoadPursue.setAuditingAdvice(Hibernate.createBlob(new byte[1]));
先插入一个obj
java二: FormFile file = inDto.getCivicimProjectDTO().getUpload();
session.flush();
session.refresh(voTShizhengRoadPursue, LockMode.UPGRADE);
BLOB blob = (oracle.sql.BLOB) voTShizhengRoadPursue.getAuditingAdvice();
OutputStream out = blob.getBinaryOutputStream();
InputStream fileContent = file.getInputStream();
byte[] buf = new byte[1024];
int len;
while ((len = fileContent.read(buf)) > 0) {
out.write(buf, 0, len);
}
fileContent.close();
out.close();
}
posted on 2007-04-18 14:56
NG 阅读(1453)
评论(0) 编辑 收藏