实体中字段: private String issueDetail ;
mapper中xml写法:
<sql id="ppiwfIssueCenterColumns">
a.id as "id",
a.city_name as "cityName",
a.county_name as "countyName",
a.power_supply_station_name as "powerSupplyStationName",
a.tg_name as "tgName",
a.tg_code as "tgCode",
a.issue_content as "issueContent",
a.issue_type as "issueType",
a.issue_state as "issueState",
a.issue_create_date as "issueCreateDate",
a.issue_process_date as "issueProcessDate",
a.issue_executor as "issueExecutor",
a.issue_target_type as "issueTargetType",
a.issue_target_name_yx as "issueTargetNameYx",
a.issue_target_code_yx as "issueTargetCodeYx",
a.issue_target_name_sc as "issueTargetNameSc",
a.issue_target_code_sc as "issueTargetCodeSc",
a.county_code as "countyCode",
a.city_code as "cityCode",
a.power_supply_station_code as "powerSupplyStationCode",
a.parent_id as "parentId",
a.issue_boundary_type as "issueBoundaryType",
a.issue_content2 as "issueContent2",
a.issue_detail as "issueDetail",
<!-- a.oa_ppiwf_ext_cooperation_id as "oaPpiwfExtCooperationId", -->
b.id as "oaPpiwfExtCooperation.id",
a.del_flag AS "delFlag",
a.remarks as "remarks",
a.receiver_name as "receiverName",
a.tg_id as "tgId",
a.org_no as "orgNo",
a.source_Table_Name as "sourceTableName"
</sql>
</update>
<update id="updateIssueDetail">
update OA_PPIWF_ISSUE_CENTER set
issue_detail=#{issueDetail,jdbcType=CLOB}
<where>
id=#{id}
</where>
</update>
java clob读取:
ppiwfIssueCenter.setId("CE19F7EF177242BEBE333D9EB916BAB4");
String sql="select * from OA_PPIWF_ISSUE_CENTER where rownum<300";
List<Map<String, Object>> temp_LM=oaSystemService.getSelectList(sql);
JSONObject jo=pcService.sqlField2Json(sql);
ppiwfIssueCenter.setIssueDetail(jo.toString());
pcService.updateIssueDetail(ppiwfIssueCenter);
//*********测试度clob**********************
sql="select o.issue_detail from OA_PPIWF_ISSUE_CENTER o where o.id='CE19F7EF177242BEBE333D9EB916BAB4'";
temp_LM=oaSystemService.getSelectList(sql);
ClobProxyImpl clob= (ClobProxyImpl)temp_LM.get(0).get("ISSUE_DETAIL");
String content;
try{
BufferedReader in;
in = new BufferedReader(clob.getCharacterStream());
StringWriter out = new StringWriter();
int c;
while ((c = in.read()) != -1)
{
out.write(c);
}
content= out.toString();
}
catch (SQLException | IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}