mybatis 存取blob

实体类定义 
 private byte[] content;
xml文件
<result column="CONTENT" property="content" jdbcType="BLOB" />
INSERT   INTO t_table (CONTENT) VALUES (#{content,jdbcType=BLOB})
存入
String content = request.getParameter("content");
setContent(content.getBytes());
取出
 
 
Blob b = new SerialBlob(getContent());
String content = new String(b.getBytes(1, (int) b.length()));


 
 

 
 

猜你喜欢

转载自blog.csdn.net/muumo/article/details/78417776