blob处理

从数据库中插入blob字段要使用字节:

args.getString("C_DESC").getBytes();

得到blob字段的特殊处理:

public String getString(String key,String defaultValue){
    Object o = values.get(key);
    if(null==o){
      return defaultValue;
    }
    if(o instanceof Blob){
      Blob m = (Blob)o;
      try{
        return new String(Streamer.toByte(m.getBinaryStream()));
      }catch(Exception e){
        throw new DaoException(L.get("bean.data_convert_fail"),e);
      }
    }
    return o+"";
  }


你可能感兴趣的:(blob字段)