当前位置: 代码迷 >> 综合 >> Clob、NClob转类型工具类
  详细解决方案

Clob、NClob转类型工具类

热度:47   发布时间:2023-11-14 16:37:50.0

感觉还有很大的改进空间,后续补上吧

public class ClobToObjectUtils {/*** Clob、nclob类型转Object* map:需转换的值* wordKey:需转换的key* @param map 转换后对象的map集合*/public static Map<String, Object> setClobToObject(Map<String, Object> map, List<String> wordKey) {if (map != null) {for (String key : wordKey) {Clob clobData = (Clob) map.get(key);String tempStr = CommonUtils.convertClobToString(clobData);String value = "";try {byte[] bytes = tempStr.getBytes("utf-8");value = new String(bytes);} catch (UnsupportedEncodingException e) {e.printStackTrace();}map.put(key, value);}}return map;}/*** Clob、nclob类型转Object* @param map 转换后对象的map集合*/