hibernate 保存图片到数据库(oracle)

String picPath = request.getSession().getAttribute("picPath").toString();
picPath = request.getSession().getServletContext().getRealPath(File.separator) +picPath;
FileInputStream fileInputStream = new FileInputStream(picPath);
xhcxGrsqEntity.setGrsqIdph(Hibernate.createBlob(fileInputStream));

//其中bean对应的字段类型定义为:
//java.sql.Blob


你可能感兴趣的:(hibernate 保存图片到数据库(oracle))