Blob和Java对象的转换

字符串转为Blob对象:

Hibernate.createBlob(str.getBytes());

 

Blob对象转为字符串:

String str= new String(blob.getBytes((long) 1,(int) blob.length()));

 

JAVA API中对应于数据库blob类型的字段有一个java.sql.Blob类

 

posted @ 2017-06-13 17:48  Huan1  阅读(6288)  评论(0编辑  收藏  举报