ykgarfield opened a new issue, #29819:
URL: https://github.com/apache/shardingsphere/issues/29819
## Question
Can using shardingsphere to operate on multiple tables in a single database
ensure transaction consistency for this single database operation ?For example,
the following code will route to the same shard database based on a certain
shard key. Can transaction consistency be ensured in this situation, or if it
is necessary to configure transaction consistency for a single database.
```java
# will route to same database
public void insertOrder(Order order, List<OrderItem> orderItems) {
orderMapper.insert(order);
orderItemMapper.batchSave(orderItems);
}
```
The above sql will operate on same database,I test the first exeucte
success, the second sql execute fail,the result is the first sql
`orderMapper.insert(order)` can not rollback。If the insertOrder method add
spring `@Transactional`,the sql execute will not enter shardinghere logic。
How should I do it,can ensure transaction consistency for multiple table
operations in a certain db。
--
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]