当前使用版本(必填,否则不予处理)

mybatis-plus 3.3.0 mybatis-plus-boot-starter 3.3.0

该问题是如何引起的?(确定最新版也有问题再提!!!)

数据库中有json类型字段,用list类型的entity接受,创建了自定义的类型转换器。xxMapper.list()方法可有效将json类型的db数据转换成entity中的list类型数据,但是如果使用 LambdaUpdateWrapper 则不会经过类型转换器,并报出error

重现步骤(如果有就写完整)

报错信息

org.springframework.dao.DataIntegrityViolationException:

Error updating database. Cause: com.mysql.cj.jdbc.exceptions.MysqlDataTruncation: Data truncation: Cannot create a JSON value from a string with CHARACTER SET 'binary'.

The error may exist in com/kezhilian/kzl/service/shop/mapper/ShopGroupMapper.java (best guess)

The error may involve com.kezhilian.kzl.service.shop.mapper.ShopGroupMapper.update-Inline

The error occurred while setting parameters

SQL: UPDATE shop_group SET sids=? WHERE deleted=2

Cause: com.mysql.cj.jdbc.exceptions.MysqlDataTruncation: Data truncation: Cannot create a JSON value from a string with CHARACTER SET 'binary'.

; Data truncation: Cannot create a JSON value from a string with CHARACTER SET 'binary'.; nested exception is com.mysql.cj.jdbc.exceptions.MysqlDataTruncation: Data truncation: Cannot create a JSON value from a string with CHARACTER SET 'binary'.

Comment From: qmdx

支持的用法


        // wrapper typeHandler 测试
        LambdaUpdateWrapper<User> wrapper = Wrappers.<User>lambdaUpdate().set(User::getWallets, Arrays.asList(new Wallet("Tom",
                Arrays.asList(new Currency("RMB", 1000d)))), "typeHandler=com.baomidou.mybatisplus.samples.typehandler.WalletListTypeHandler");
        wrapper.eq(User::getId, 2L);
        Assertions.assertEquals(userMapper.update(new User().setAge(99), wrapper), 1);
        System.err.println(userMapper.selectById(2));