在mysql 中 text类型的字段: service_detail text NULL 服务描述   。 对应java文件中 model 中的 String:  private String serviceDetail;

在 mybatis 中的xml 中定义的是 :

<resultMap id="ResultMapWithBLOBs" type="com.eachonline.goods.model.ServiceGoodsBase" extends="BaseResultMap" >
  <result column="service_detail" property="serviceDetail" jdbcType="LONGVARCHAR" />
</resultMap>

基本表的定义:

 <resultMap id="BaseResultMap" type="com.goods.model.ServiceGoodsBase" >
<id column="sid" property="sid" jdbcType="VARCHAR" />
<result column="service_name" property="serviceName" jdbcType="VARCHAR" />
<result column="service_district" property="serviceDistrict" jdbcType="VARCHAR" />
<result column="longitude" property="longitude" jdbcType="VARCHAR" />
<result column="latitude" property="latitude" jdbcType="VARCHAR" />
<result column="address" property="address" jdbcType="VARCHAR" />
<result column="service_fee" property="serviceFee" jdbcType="DOUBLE" />
<result column="service_price" property="servicePrice" jdbcType="DOUBLE" />
<result column="service_unit" property="serviceUnit" jdbcType="VARCHAR" />
<result column="user_service_type_id" property="userServiceTypeId" jdbcType="VARCHAR" />
<result column="service_type" property="serviceType" jdbcType="VARCHAR" />
<result column="release_time" property="releaseTime" jdbcType="VARCHAR" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" /> </resultMap>
 <sql id="Base_Column_List" >
sid, service_name, service_district, longitude, latitude, address, service_fee, service_price,
service_unit, user_service_type_id, service_type, release_time, create_time, is_use,
module, check_status, check_comment, click_num, discount, service_status, service_sale_num,
data_source, commodity_type
</sql>
<sql id="Blob_Column_List" >
service_detail
</sql>
  <select id="selectByPrimaryKey" resultMap="ResultMapWithBLOBs" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from service_goods_base
where sid = #{sid,jdbcType=VARCHAR}
</select>

对于修改的操作,有两个方法: updateByPrimaryKeySelective  , updateByPrimaryKeyWithBLOBs

mybatis 处理 mysql 表中的 text类型的 字段的更多相关文章

  1. MYSQL表中向SET类型的字段插入值时值之间不能有空格

    MYSQL 中有一种数据类型是 SET,首先我们查看一个包含 SET 类型字段的表结构: 接下来我们向表中插入数据: 按照上面的语句插入数据发现报错了,于是去掉了插入值之间的空格,然后插入成功:

  2. 数据库表中存在Text类型的属性时,写sql语句时需要注意喽!

    之前,习惯性地写查询语句时,查询条件用“=”判断.今天写程序的时候,查询时突然报了一个错误:数据类型text 和varchar 在equal to 运算符中不兼容.查看了一下数据库发现,其中有一个属性 ...

  3. mysql 表中已经存在数据 修改字段类型 varchar(11) 改为 int(11)

    update tablename set s_role = '' alter table  tablename  modify column s_role int(11)

  4. MYSQL表中设置字段类型为TIMESTAMP时的注意事项

    在MYSQL中,TIMESTAMP类型是用来表示日期的,但是和DATETIME不同,不同点就不再这里说明了. 当我们在使用TIMESTAMP类型设置表中的字段时,我们应该要注意一点,首先我们在表中新增 ...

  5. 着重基础之—MySql Blob类型和Text类型

    着重基础之—MySql Blob类型和Text类型 在经历了几个Java项目后,遇到了一些问题,在解决问题中体会到基础需要不断的回顾与巩固. 最近做的项目中,提供给接口调用方数据同步接口,传输的数据格 ...

  6. mysql语句中把string类型字段转datetime类型

    mysql语句中把string类型字段转datetime类型   在mysql里面利用str_to_date()把字符串转换为日期   此处以表h_hotelcontext的Start_time和En ...

  7. MySQL表中的数据类型

    数据类型:在表中数据类型主要是限制字段必须以什么样的数据类型传值. 一 整型 整数类型:TINYINT SMALLINT MEDIUMINT INT BIGINT总共有五种,name我们一般用到的也就 ...

  8. 清除mysql表中数据

    delete from 表名; truncate table 表名; 不带where参数的delete语句可以删除mysql表中所有内容,使用truncate table也可以清空mysql表中所有内 ...

  9. SQL查询数据库中所有指定类型的字段名称和所在的表名

    --查询数据库中所有指定类型的字段名称和所在的表名 --eg: 下面查的是当前数据库中 所有字段类型为 nvarchar(max) 的字段名和表名 SELECT cols.object_id , co ...

随机推荐

  1. windwos at 以及shutdown使用方法

    at 12:00 shutdown -r如果今天12点没过去,今天12点重启,如果今天12点已经过去,明天12点重启.每天12点重启的命令是at 12:00 /every:Monday,Tuesday ...

  2. Intellij IDEA 10.5 语言设置

    适应于:英文操作系统,但是语言和区域设置为中文的环境. Mac: /Applications/IntelliJ IDEA CE.app/Contents/bin/idea.vmoptions 增加 - ...

  3. 08-spring学习-annotation配置

    利用annotation配置注入关系 为了更好的解释此类存在的意义,下面通过一段习惯性的开发进行问题的描述,例如: 现在有一个IAdminService服务层,这个服务层要调用的是IAdminDAO和 ...

  4. struts2异常处理

    <global-results> <result name="nullException">/WEB-INF/exception/nullException ...

  5. css盒子模型及属性介绍(margin,padding)

    每个HTML元素都可以看作装了东西的盒子 盒子具有宽度(width)和高度(height) 盒子里面的内容到盒子的边框之间的距离即填充(margin) 盒子本身有边框(border) 而盒子边框外和其 ...

  6. C#颜色 Color.FromArgb ColorTranslator 16进制

    //方法1: //引用命名空间 using System.Drawing; 16进制颜色代码转Color类型:ColorTranslator.FromHtml(color); Color类型转16进制 ...

  7. Codeforces Round #265 (Div. 2) B. Inbox (100500)

    Over time, Alexey's mail box got littered with too many letters. Some of them are read, while others ...

  8. Atitit. 脚本语言的断点单步调试的设计与实现 attialx 总结 php 参照java

    Atitit. 脚本语言的断点单步调试的设计与实现 attialx 总结 php 参照java 1. 断点的实现:手动断点 die和exit是等价的 1 2. 变量表的实现 1 3. print_r( ...

  9. Python学习笔记7:函数对象及函数对象作參数

    一.lambda函数 比如: fun1 = lambda x,y: x + y print fun1(3,4) 输出:7 lambda生成一个函数对象.该函数參数为x,y,返回值为x+y.函数对象赋给 ...

  10. 折腾gcc/g++链接时.o文件及库的顺序问题(转)

    转自: http://www.cnblogs.com/OCaml/archive/2012/06/18/2554086.html#sec-1-1 折腾gcc/g++链接时.o文件及库的顺序问题 Tab ...