lMasterSparkl commented on issue #7703:
URL: 
https://github.com/apache/shardingsphere/issues/7703#issuecomment-1067909193


   
   > > So a safer option would be to define an Annotation, something like 
"@ForceWhereClause" which should then indicate to sharding-sphere that it has 
to use the value from SET clause and either use that to figure out which is the 
target shard, or put in a where clause along in the final statement and let 
things happen naturally.
   > 
   > @sabz90 I think adding annotations is a good idea, but I think it is more 
appropriate for hibernate to provide this annotation. Users can freely control 
which fields are added to the `WHERE` clause and which fields are added to the 
`SET` clause through hibernate annotations.
    
   @tristaZero @strongduanmu @heqiao @sabz90 @qiuxiaotong2021 
   hey guys I have read all this issue's comments and  think it's necessary to 
reopen this issue .
   ### First 
   I think the comment I have quote is not the final reply that   
   
   > more appropriate for hibernate to provide this annotation
   
     
   and it doesn't solution the problem.
   ### Second 
   let me example:
   table AAA use 'id' as primary key and use 'did' as sharding key .
   now I need to edit some columns from backstage, I think it's a very easy and 
universal function, but wow it says **'Can not update sharding key'** and don't 
have Elegant solutions,  now I have to judge every column and use jpa‘s 
nativeQuery to update columns .
   we use did to distinguish different user so it can be the same.
   ### Final 
   let me guess the question I have figure out when I have debug, 
   
![shardingsphereDebug](https://user-images.githubusercontent.com/24791147/158369713-0216adb9-5334-4b88-8ffe-39b8531d889e.png)
   in this pic shardingValue is empty and I deep in
   
![shardingSpheregetShardingValue](https://user-images.githubusercontent.com/24791147/158369683-8c27eb7a-d7d4-4f5d-b3e5-7cb70a4d3fc6.png)
   in this pic shows shardingColumn is 'did' but in Evaluate I excute 
column.getIdentifier().getValue() and it return 'id' so i think it just 
consider when shardingColumn is primary key and value equals and then pass but 
not contain when shardingKey is not primary key's case.
   my english is not good but I'd like to discuss this 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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to