问题:某个字段的类型为text(或者mediumtext,longtext)的时候,用selectByQuery语句查询出来的结果不包含该字段内容。

 

myibatis 用mybatis-generator自动生成以后,text,mediumtext,longtext跟普通的varchar,char类型的字段会有区别。

如下:

  <resultMap id="BaseResultMap" >
 
    <id column="id" property="id" jdbcType="BIGINT" />
    <result column="gmt_create" property="gmtCreate" jdbcType="TIMESTAMP" />
    <result column="gmt_modified" property="gmtModified" jdbcType="TIMESTAMP" />
 
  </resultMap>
  <resultMap id="ResultMapWithBLOBs" extends="BaseResultMap" >
 
    <result column="job_content" property="jobContent" jdbcType="LONGVARCHAR" />
  </resultMap>

不单单只有“BaseResultMap”,还有一个“ResultMapWithBLOBs”,

后面在查询的时候,有两个select,一个是只包含BaseResultMap的selectByQuery,另外一个是包含BaseResultMap和ResultMapWithBLOBs的selectByQueryWithBLOBs。

 

结论:如果所有内容都想查询,就要用selectByQueryWithBLOBs,默认的selectByQuery会有问题。

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-07
  • 2022-12-23
  • 2021-08-29
  • 2022-12-23
  • 2022-03-10
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-05-31
  • 2022-02-23
  • 2022-12-23
  • 2021-09-06
  • 2022-03-05
相关资源
相似解决方案