Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如何解决在同一个方法中,同时操作修改、新增、删除三种操作的同时,使所有操作在同一个事务中,以此来保证一个失败,全部回滚 #449

Open
AwenJackson opened this issue Oct 9, 2022 · 3 comments
Labels
Enhancement 增强 增强功能、提高性能等 Question 使用问题 使用问题 Transaction 事务

Comments

@AwenJackson
Copy link
Contributor

AwenJackson commented Oct 9, 2022

下面是主要代码,请问各位大佬该怎么解决?我并不知道我哪里出错了,就是无法实现在一个事务中保证一个失败,全部回滚

@TommyLemon
Copy link
Collaborator

TommyLemon commented Oct 18, 2022

需要复用 SQLExecutor,参考
https://blog.csdn.net/aa330233789/article/details/105309571

或者类似 /login, /register 接口自己通过补偿来还原失败情况导致的更改。

当然一般不建议用 APIJSON 手写代码,APIJSON 主要用来提供零代码的万能通用 API,复杂业务建议通过现有的其它方式实现。

@TommyLemon TommyLemon added Enhancement 增强 增强功能、提高性能等 Question 使用问题 使用问题 Transaction 事务 labels Oct 18, 2022
@TommyLemon
Copy link
Collaborator

TommyLemon commented Feb 17, 2023

@AwenJackson 6.0.0 新增支持全能接口 /crud,一个请求 JSON 同时使用多种 CRUD 操作,并支持跨源事务,感谢 @cloudAndMonkey 的贡献 #481 #485

https://github.com/Tencent/APIJSON/releases/tag/6.0.0

对应文档
https://github.com/Tencent/APIJSON/blob/master/README-extend.md

@AwenJackson
Copy link
Contributor Author

AwenJackson commented Feb 17, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement 增强 增强功能、提高性能等 Question 使用问题 使用问题 Transaction 事务
Projects
None yet
Development

No branches or pull requests

2 participants