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()));







發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章