incorrect string value: '\xF0\x9F\x8D\x91\xE5\xB0...' for column...
1.spring配置文件:
<property name="url"
value="jdbc:mysql://596c8c09e97fb.sh.cdb.myqcloud.com:5032/hotkidclub_production_bak?useUnicode=true&serverTimezone=GMT%2B8&characterEncoding=utf8&character_set_client=utf8mb4&character_set_server=utf8mb4&character_set_connection=utf8mb4&character_set_results=utf8mb4&noAccessToProcedureBodies=true&allowMultiQueries=true"/>
2.修改需要存储字符表情的字段字符集编码为utf8mb4
3.在需要插入字段的前面增加set NAMES 'utf8mb4',mybatis配置如下:
在xml文件中配置一个方法
<update id="setUtfmb4">SET NAMES utf8mb4</update>
4.
//转码 这里会将对象Abc 转码为utfmb4
xxMapper.setUtfmb4();
xxMapper.updateAbc(abc);
xxMapper.addAbc(abc);