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

spring里面对事务的控制@Transactional #12

Open
Lynne0 opened this issue Jun 27, 2019 · 1 comment
Open

spring里面对事务的控制@Transactional #12

Lynne0 opened this issue Jun 27, 2019 · 1 comment

Comments

@Lynne0
Copy link

Lynne0 commented Jun 27, 2019

请问下,spring里面对事务的控制@transactional,这个注解的应用场景在这个项目中,为什么执行查询操作的时候不用它,执行update和delete操作时候要用它呢

@shimh-develop
Copy link
Owner

牵扯到数据的修改,比如:保存用户 同时保存用户的角色,为了保证数据的一致性等,都需要加上事物;当然对于查询操作,一个方法有多个select,如果要保证读记录的数据一致性的话,可以加上只读事物 @transactional(readOnly = true)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants