Skip to content

希望对apijson事务有一个系统的介绍 #674

New issue

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

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

Already on GitHub? # to your account

Open
hongxiao2016 opened this issue Jan 27, 2024 · 2 comments
Open

希望对apijson事务有一个系统的介绍 #674

hongxiao2016 opened this issue Jan 27, 2024 · 2 comments

Comments

@hongxiao2016
Copy link

hongxiao2016 commented Jan 27, 2024

Description

对于6.3.0版本的使用,我是一个新手,在学习了解apijson的时候,尤其是事务这一块,比较晕,看了很多文档还是晕,感觉比较散,看到了很多说明,比如说Function实现事务,重写begin、commit、rollback等自己手动统一进行事务控制,还有判断是否为最后一条sql等等,也在网上看到某个“火车票”相关的系统,但是由于版本的问题,很多东西变了,但是最终还是没有解决问题。

猜想:

  1. 前段处理: 发送请求的时候就指定这个是“事务”
  2. 后端处理:开始执行sql前、执行发生异常时、没有异常顺利执行完 是否会有切面让用户控制事务。

有相关的事务demo吗?求求大佬了,这个项目真的是极好的,谢谢大佬。

@TommyLemon
Copy link
Collaborator

TommyLemon commented Jan 30, 2024

GET, HEAD 这两个查询方法默认不开事务,其它默认开启。
事务是在后端控制,保证安全和避免脏数据,可以重写 setAutoCommit, onCommit, onRollback 等方法自定义

#531
#572
#270 (comment)
#468

@TommyLemon
Copy link
Collaborator

TommyLemon commented Jan 30, 2024

所有 Demo 中的所有通用 增/删/改 接口全都是自动处理事务,没有特殊需求的不需要额外处理,如果执行了远程函数,只要抛异常即可自动触发 roll back 事务回滚
https://github.com/APIJSON/APIJSON-Demo/tree/master/APIJSON-Java-Server

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants