栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

sharding-sphere报错总结

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

sharding-sphere报错总结

Sharding-Sphere报错总结

① sharding-sphere不支持多条update语句批量更新,不报错,多条只更新一条。

 update msp_voucher_0 set destory_date = '2022-05-12 00:00:00.0', status = 5
 WHERe coupon_no = '17659452900000' and thrid_voucher_no = 'test1' ; 
 update msp_voucher_0 set destory_date = '2022-05-12 00:00:00.0', status = 5
 WHERe coupon_no = '17659452900000' and thrid_voucher_no = 'test2' ; 
 update msp_voucher_0 set destory_date = '2022-05-12 00:00:00.0', status = 5
 WHERe coupon_no = '17659452900000' and thrid_voucher_no = 'test3';

② INESRT INTO … ON DUPLICATE KEY UPDATE use the dynamic parameter

使用insertOrUpdateBatch 无则插入,有则更新时报错,原因未知

③ java.lang.String.mod() is applicable for argument types: (java.lang.Integer) values: [32]

类型转换错误:coupon_no数据库为varchar,不能取余

Spring: 
	shardingsphere: 
		sharding:
          default-data-source-name: ds1
          tables:
            msp_voucher: # 逻辑表名
              actual-data-nodes: ds0.msp_voucher_$->{0..31} # 真实表名,一般是逻辑表名后对一个有一定规则的后缀
              table-strategy:
                inline:
                  sharding-column: coupon_no
                  algorithm-expression: msp_voucher_$->{coupon_no % 32}
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/915566.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号