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:
[email protected]


Reply via email to