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/12/08 08:05:42 UTC

[GitHub] [shardingsphere] huanqwer opened a new issue #8529: Sharding value must implements Comparable.

huanqwer opened a new issue #8529:
URL: https://github.com/apache/shardingsphere/issues/8529


   ## Bug Report
   
   Under JPA use repository to save entity to DB
   I defined my own ComplexKeysShardingAlgorithm use two columns (dealer_id & company_code) to shard table
   But these two columns could not be null, when one of them is null
   Then got java.lang.IllegalArgumentException: Sharding value must implements Comparable.
   
   ### Which version of ShardingSphere did you use?
   
   implementation 'org.apache.shardingsphere:sharding-jdbc-core:4.1.1'
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   
   ShardingSphere-JDBC
   
   ### Expected behavior
   
   JPA repo save successfully
   
   ### Actual behavior
   
   got java.lang.IllegalArgumentException: Sharding value must implements Comparable.
   
   ### Reason analyze (If you can)
   
   In org.apache.shardingsphere.sharding.route.engine.condition.engine.InsertClauseShardingConditionEngine#getRouteValue
   ```java
   Preconditions.checkArgument(result instanceof Comparable, "Sharding value must implements Comparable.");
   ```
   this code will check sharding value is instanceof Comparable and throw above Exception
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   
   as above
   
   ### Example codes for reproduce this issue (such as a github link).
   
   as above
   


----------------------------------------------------------------
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



[GitHub] [shardingsphere] huanqwer commented on issue #8529: Sharding value must implements Comparable.

Posted by GitBox <gi...@apache.org>.
huanqwer commented on issue #8529:
URL: https://github.com/apache/shardingsphere/issues/8529#issuecomment-741505410


   finally I use @Convert annotation in jpa to convert null to "",


----------------------------------------------------------------
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



[GitHub] [shardingsphere] huanqwer closed issue #8529: Sharding value must implements Comparable.

Posted by GitBox <gi...@apache.org>.
huanqwer closed issue #8529:
URL: https://github.com/apache/shardingsphere/issues/8529


   


----------------------------------------------------------------
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



[GitHub] [shardingsphere] huanqwer commented on issue #8529: Sharding value must implements Comparable.

Posted by GitBox <gi...@apache.org>.
huanqwer commented on issue #8529:
URL: https://github.com/apache/shardingsphere/issues/8529#issuecomment-740457216


   I guess if save operation throws this Exception, other DDL operations may have the same problem


----------------------------------------------------------------
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



[GitHub] [shardingsphere] huanqwer commented on issue #8529: Sharding value must implements Comparable.

Posted by GitBox <gi...@apache.org>.
huanqwer commented on issue #8529:
URL: https://github.com/apache/shardingsphere/issues/8529#issuecomment-740455688


   I wonder if there is a simple way to save entity successfully when sharding value is null


----------------------------------------------------------------
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