JAVA+ORACLE+BLOB+Mybatis
實體類:
private byte[] richContent;
public byte[] getRichContent() {
return richContent;
}

public void setRichContent(byte[] richContent) {
this.richContent = richContent;
}
Mapper.xml
<result column="RICH_CONTENT" property="richContent" jdbcType="BLOB" typeHandler="org.apache.ibatis.type.BlobTypeHandler"/>
<if test="richContent != null" >
UPDATE_DATE = #{richContent,jdbcType=BLOB},
</if>JSP
CONTROL顯示:








Mapper.xml




<td class="propname">發布內容:</td>CONTROL保存
<td class="propvalue" colspan="6">
<div id="myEditor" type="text/plain" name='content' style="width: 900px;height:400px;"/>
</td>
//利用content轉換為二進制,存入richcontent
String strRich = newsBean.getContent();
if(strRich.length()>0) {
byte[] temp = strRich.getBytes();
newsBean.setRichContent(temp);
newsBean.setContent("");
}
CONTROL顯示:
if(casNewsModel.getRichContent().length>0) {
content = new String(casNewsModel.getRichContent());
casNewsModel.setContent(content);
}