Home > Java > javaTutorial > body text

Recommended articles about @Transactional

零下一度
Release: 2017-06-13 10:06:20
Original
1365 people have browsed it

1. Examples of usage scenarios Before understanding how to use @Transactional, we must first know what @Transactional is used for. Here's an example: For example, there are many members in a department, which are stored in the department table and member table respectively. When deleting a department, assume that we delete the corresponding members by default. However, this situation may occur during execution. We delete the department first, and then delete the members. However, the department is deleted successfully, but an exception occurs when deleting the members. At this time, we hope that if the member deletion fails, the previously deleted departments will also be undelete. In this scenario, you can use @Transactional transaction rollback. 2. Checked exceptions and unchecked exceptions The reason why everyone is clear about the concepts of checked exceptions and unchecked exceptions is because: Spring uses declarative transaction processing. By default, if an unchecked exception occurs in the annotated database operation method, all databases The operation will rollback; if the exception that occurs is a checked exception, the database operation will still be submitted by default. ch

1. Detailed introduction to the @Transactional transaction rollback example and source code in Spring (picture)

Recommended articles about @Transactional

Introduction: 1. Examples of usage scenarios Before understanding how to use @Transactional, we must first know what @Transactional is used for. Here's an example: For example, there are many members in a department, which are stored in the department table and member table respectively. When deleting a department, assume that we delete the corresponding members by default. However, this situation may occur during execution. We delete the department first, and then delete the members. However, the department is deleted successfully, but an exception occurs when deleting the members. At this time, we hope that if the member deletion fails, the previously deleted departments will also be undelete. In this scenario, you can use @Tran..

2. Detailed introduction to the usage of @Transactional in Spring

Recommended articles about @Transactional

Introduction: This article mainly introduces the relevant information about the usage of @Transactional in Spring. Friends in need can refer to it

3. Spring combined with mysql transaction annotation @Transactional does not work related issues

Introduction: spring combined with mysql transaction annotation @Transactional does not work related problems encountered recently I encountered a rather strange problem. It seems that all configurations are correct, but the transaction does not work. First, the configuration file of the resin server to connect to the database is as follows: databasejndi-namejdbc/bbs7_app/jndi-namedrivertypecom.mysql.jdbc.jdbc2.opti

[Related Q&A recommendations]:

java - Answers to spring boot transaction management issues

hibernate - Using Spring's declarative transaction, I get the exception no transaction is in progressjava

java - Unit test, how to let spring manage transactions without polluting the database

java - Global transaction rollback but transactional code commit?

java - spring After enabling SERIALIZABLE level transactions, other transactions can still be queried

The above is the detailed content of Recommended articles about @Transactional. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!