You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2020/06/04 03:55:57 UTC

[GitHub] [shardingsphere] ljz0721cx commented on issue #5876: use config SNOWFLAKE Sharding value must implements Comparable

ljz0721cx commented on issue #5876:
URL: https://github.com/apache/shardingsphere/issues/5876#issuecomment-638587272


   > logic
   DROP TABLE IF EXISTS `t_order0`;
   CREATE TABLE `t_order0`  (
     `order_id` bigint(20) NULL DEFAULT NULL COMMENT '订单id',
     `order_no` bigint(20) NOT NULL COMMENT '订单号',
     `user_id` int(20) NULL DEFAULT NULL COMMENT '用户id',
     `status` varchar(10) CHARACTER SET big5 COLLATE big5_chinese_ci NULL DEFAULT NULL COMMENT '状态码',
     `create_date` datetime(0) NULL DEFAULT NULL,
     PRIMARY KEY (`order_no`) USING BTREE
   ) ENGINE = InnoDB CHARACTER SET = big5 COLLATE = big5_chinese_ci ROW_FORMAT = Compact;
   
   DROP TABLE IF EXISTS `t_order1`;
   CREATE TABLE `t_order0`  (
     `order_id` bigint(20) NULL DEFAULT NULL COMMENT '订单id',
     `order_no` bigint(20) NOT NULL COMMENT '订单号',
     `user_id` int(20) NULL DEFAULT NULL COMMENT '用户id',
     `status` varchar(10) CHARACTER SET big5 COLLATE big5_chinese_ci NULL DEFAULT NULL COMMENT '状态码',
     `create_date` datetime(0) NULL DEFAULT NULL,
     PRIMARY KEY (`order_no`) USING BTREE
   ) ENGINE = InnoDB CHARACTER SET = big5 COLLATE = big5_chinese_ci ROW_FORMAT = Compact;
   
   
   ###excute error  message
   ### Error updating database.  Cause: java.lang.IllegalArgumentException: Sharding value must implements Comparable.
   ### The error may exist in file [D:\myworkers\myworkspace\spring-nacos\spring-shanding-db\target\classes\mapper\TransBillExtendsMapper.xml]
   ### The error may involve com.bule.spring.dao.OrderShardingMapper.insert-Inline
   ### The error occurred while setting parameters
   ### SQL: INSERT INTO t_order (            order_id,order_no, user_id, status,create_date         )         VALUES (             ?,             ?,             ?,             ?,             ?         )
   ### Cause: java.lang.IllegalArgumentException: Sharding value must implements Comparable.
   	at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
   	at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:199)
   	at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:184)
   	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   	at java.lang.reflect.Method.invoke(Method.java:498)
   	at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:426)
   	... 37 more
   Caused by: java.lang.IllegalArgumentException: Sharding value must implements Comparable.
   	at com.google.common.base.Preconditions.checkArgument(Preconditions.java:122)
   	at org.apache.shardingsphere.sharding.route.engine.condition.engine.InsertClauseShardingConditionEngine.getRouteValue(InsertClauseShardingConditionEngine.java:112)
   	at org.apache.shardingsphere.sharding.route.engine.condition.engine.InsertClauseShardingConditionEngine.createShardingCondition(InsertClauseShardingConditionEngine.java:94)
   	at org.apache.shardingsphere.sharding.route.engine.condition.engine.InsertClauseShardingConditionEngine.createShardingConditions(InsertClauseShardingConditionEngine.java:65)
   	at org.apache.shardingsphere.sharding.route.engine.ShardingRouteDecorator.getShardingConditions(ShardingRouteDecorator.java:80)
   	at org.apache.shardingsphere.sharding.route.engine.ShardingRouteDecorator.decorate(ShardingRouteDecorator.java:62)
   	at org.apache.shardingsphere.sharding.route.engine.ShardingRouteDecorator.decorate(ShardingRouteDecorator.java:53)
   	at org.apache.shardingsphere.underlying.route.DataNodeRouter.executeRoute(DataNodeRouter.java:91)
   	at org.apache.shardingsphere.underlying.route.DataNodeRouter.route(DataNodeRouter.java:76)
   	at org.apache.shardingsphere.underlying.pluggble.prepare.PreparedQueryPrepareEngine.route(PreparedQueryPrepareEngine.java:54)
   	at org.apache.shardingsphere.underlying.pluggble.prepare.BasePrepareEngine.executeRoute(BasePrepareEngine.java:96)
   	at org.apache.shardingsphere.underlying.pluggble.prepare.BasePrepareEngine.prepare(BasePrepareEngine.java:83)
   	at org.apache.shardingsphere.shardingjdbc.jdbc.core.statement.ShardingPreparedStatement.prepare(ShardingPreparedStatement.java:183)
   	at org.apache.shardingsphere.shardingjdbc.jdbc.core.statement.ShardingPreparedStatement.execute(ShardingPreparedStatement.java:143)
   	at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:47)
   	at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:74)
   	at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:50)
   	at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117)
   	at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:76)
   	at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:197)
   	... 43 more
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org