mybatis查询CLOB

时间:2025-03-12 07:14:57

<1>JAVA类

public class OracleClobTypeHan implements TypeHandler<Object> {
      
      public Object valueOf(String param) {
        return null;
      }

      @Override
      public Object getResult(ResultSet arg0, String arg1) throws SQLException {
//        Clob clob = ((ClobProxyImpl) (arg1)).getRawClob();
//          CLOB clob = (CLOB) (arg1);
          Clob clob = null;
          if((arg1)!=null){
              clob = ((ClobProxyImpl) (arg1)).getRawClob();
          }else{
              clob = (CLOB) (arg1);
          }
        return (clob == null || () == 0) ? null : ((long) 1, (int) ());
      }

      @Override
      public Object getResult(ResultSet arg0, int arg1) throws SQLException {
        return null;
      }

      @Override
      public Object getResult(CallableStatement arg0, int arg1) throws SQLException {
        return null;
      }

      @Override
      public void setParameter(PreparedStatement arg0, int arg1, Object arg2, JdbcType arg3) throws SQLException {
        CLOB clob = CLOB.empty_lob();
        (1, (String) arg2);
        (arg1, clob);
      }
    }

<2>xml

          <result column="YL_DESC3" property="ylDesc3" jdbcType="CLOB" javaType = ""
     typeHandler =""/>