RaigorJiang commented on issue #13562:
URL: 
https://github.com/apache/shardingsphere/issues/13562#issuecomment-981299348


   Hi @qq379872286,
   I investigated the problem you reported and found the reason why the SQL 
statement has been routed to write-data-source:
   1. The `processSuccess()` method in example 
[service](https://github.com/apache/shardingsphere/blob/master/examples/example-core/example-spring-mybatis/src/main/java/org/apache/shardingsphere/example/core/mybatis/service/OrderServiceImpl.java)
 declares @Transactional. 
   2. If there is a write operation in the same transaction, the read operation 
will also be routed to the write-data-source;
   
   So this is normal behavior. If you remove the @Transactional declaration, 
you can observe normal routing. 
   However, because many people do not configure the replication sync when 
running the example, this may cause the data query to fail.


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