zjcnb commented on issue #14949:
URL: 
https://github.com/apache/shardingsphere/issues/14949#issuecomment-1018109453


   > > > hello, my project use jpa + shardingjdbc when i use 
CrudRepository.save to save my data to database,jpa auto generated sql like 
`update table_a set field_a = 1 , field_ab = 2 where id = 3` but my 
sharding-key is another field "dealership_id"。So my sql execute route to all 
data node. I would like to ask, is there any way to deal with this situation?
   > > 
   > > 
   > > I think your sql must be contains sharding_key column.
   > 
   > [#970 
(comment)](https://github.com/apache/shardingsphere/issues/970#issuecomment-1017241107)
   
   ShardingSphere not supprot route all nodes when you execute insert or save 
sql, Now.
   
   ```
     if (!routeContext.isSingleRouting() && 
!shardingRule.isBroadcastTable(tableName)) {
               boolean isSingleDataNode = 
routeContext.getOriginalDataNodes().stream().allMatch(dataNodes -> 
dataNodes.size() == 1);
               Preconditions.checkState(isSingleDataNode, "Insert statement 
does not support sharding table routing to multiple data nodes.");
           }
   ```


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