两个数据源 各自启动事务 保持隔离
最后更新:2024-09-09 05:30:01
|
状态:未完成
String url = "jdbc:mysql://localhost:33306/simple_sso?useUnicode=true&characterEncoding=UTF8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true"; DataSourceHolder.reg("sso", "com.zaxxer.hikari.HikariDataSource", "com.mysql.cj.jdbc.Driver", url, "root", "root"); url = "jdbc:mysql://localhost:33306/simple_crm?useUnicode=true&characterEncoding=UTF8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true"; DataSourceHolder.reg("crm", "com.zaxxer.hikari.HikariDataSource", "com.mysql.cj.jdbc.Driver", url, "root", "root"); TransactionState state_sso = TransactionProxy.start("sso"); ServiceProxy.service("sso").delete("sso_user", "id", "1"); TransactionState state_crm = TransactionProxy.start("crm"); ServiceProxy.service("crm").delete("crm_user", "id", "1"); TransactionProxy.rollback(state_crm); TransactionProxy.rollback(state_sso);