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


   Thanks for your feedback. @heqiao @sabz90 
   I read the conversation above, and gave my thinking here.
   First, the annotation `@Column(name = "xxx", updatable = false)` seems one 
solution to avoid `SET shardingKey=xxx`and the exception `Can not update 
sharding key` accordingly.
   
   Second, how to understand `But this will execute the update query in all the 
shards :) Which is not optimal.`? 
   Does it mean that if `@Column(name = "xxx", updatable = false)` is added, 
the `where clause` will not contain `shardingKey=xx`, which will cause all 
shards updating?
   
   Third, Do you think the following improvement is reasonable and in your 
expectation?
   ```JAVA
   if (no shardingKey in SET Clause)
       then PASS
   else if (the value of shardingKey in SET Clause == the value of shardingKey 
in WHERE Clause)
       then PASS
   else
       then an exception
   ````


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