2012年3月26日星期一

Beats By DreI use hibernate storage Blob image is found when this problem

I use hibernate storage Blob image is found when this problem, original picture byte is 2570, save to the Oracle database,Beats By Dre, byte into 2717, and use the HQL statement to get the blob object,Coach Outlet Store, check out blob byte is still 2570,Nike Running Shoes, the image can be displayed properly, but the use of pure SQL read blob 2717, the image does not display, do not know what the reason is.
Oracle blob is oracle.sql.BLOB, procedures in the entity class BLOB type javax.sql.rowset.serial.SerialBlob,UGG Boots UK, does oracle.sql.BLOB converted to javax.sql.rowset.serial.SerialBlob need anything special? Hibernate is how to deal with both the conversion?Below is the hibernate configuration file in BLOB field mapping: < property name = "infPhoto" type = "javax.
sql.rowset.serial.SerialBlob" > < column name = "inf_photo" sql-type = "BLOB" / > / property> < infPhoto; from CmsInfo where rowId select = '1' for blob is 2570 the length of the blob,Moncler Outlet, can display the picture, but the use of the pure SQL to obtain the blob length is 2717 (the length and stored in the Oracle database blob is of the same length): String SQL = "select inf_photo from cms_info where row_id = '" + this.
imageRowId + "."; Object obj1 = service.getJdbcTemplate (). QueryForObject (SQL, Blob.class); if (obj1! = null) {Blob B = (Blob) obj1; logger.info (b.length ()); / / 2717 SerialBlob BB = new SerialBlob (b); logger.
info ("conversion 1:"); logger.info (bb.length ()); / / convert after 2717, do not know by what method to convert SerialBlob can be obtained after the original length?} which prawn knows this problem, thank you.
Related articles:

没有评论:

发表评论