xiaoxiangyeyu0 commented on issue #7686:
URL: 
https://github.com/apache/incubator-seata/issues/7686#issuecomment-3389139627

   > > Adding readOnly to the `@Transactional` annotation on a read-only SQL 
method will prevent the registration of an XA branch.
   > 
   > 您好,这个方式我恐怕不能使用,因为service里面的select语句,dml语句都有,没法单独给哪些做readonly
   > 
   > 现在应该是两个方向:
   > 
   > 1. [@transactional](https://github.com/transactional) 注解时 , 能够切换数据源, 
这一块似乎跟spring现在用的JdbcTransactionManager以及[@ds](https://github.com/ds)的实现也有关系,跟seata好像也有点关系,seata也有一个自己的tm。。。我再研究下吧,我觉得这个方式可能更好些,因为seata的@GlobalTransactional,一般是涉及到分布式事务时才加,而[@transactional](https://github.com/transactional)只要涉及数据变更就会加了,很难为了支持切数据源再把这个注解去掉
   > 2. 
seata事务不加[@transactional](https://github.com/transactional)注解时,除了能切换数据源,还能够优化一下实现,使得尽量减少分支事务的创建,比如
   > 
   > 这个问题本质我觉得是希望能够 seata 
事务(at/xa)在开启[@transactional](https://github.com/transactional)注解的同时,能够切换数据源,可能不完全是seata的事,但是我觉得应用场景是比较普遍的吧,比如
 读写分离场景
   > 
   > 另外,刚才不小心把这个bug给close了,麻烦各位可以再打开继续讨论
   
   单独设置@Transactional(readOnly = 
true)后,你DS就切换不了数据源了,加上DSTransactional可以切换数据源,但是目前它没有支持readOnly配置,要不你把@Transactional(readOnly
 = 
true)、@DSTransactional和@GlobalTransactional都加上看看是什么结果【/捂脸】,这样还不行的话,就只能拆成远程服务调用的方式了


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to