1、String 转 Blob:
String content = "Hello World!";
Blob blob = Hibernate.createBlob(content.getBytes());
2、Blob 转 String:
Blob blob;
try{
String content = new String(blob.getBytes((long)1, (int)blob.length()));
} catch(SQLException e) {
e.printStackTrace();
}
Java Blob类型和String类型相互转换
最新推荐文章于 2024-08-02 10:39:13 发布