Home > Java > javaTutorial > What is transaction in JAVA

What is transaction in JAVA

藏色散人
Release: 2019-06-03 16:21:59
Original
7122 people have browsed it

What is transaction in JAVA

The usual concept is that transactions are only related to the database.

Transactions must comply with the ACID principles established by ISO/IEC. ACID is the abbreviation for atomicity, consistency, isolation and durability. The atomicity of a transaction means that any failure during transaction execution will cause any modifications made by the transaction to become invalid. Consistency means that when a transaction fails, all data affected by the transaction should be restored to the state before the transaction was executed. Isolation means that modifications to data during transaction execution are not visible to other transactions before the transaction is committed. Persistence means that the status of the submitted data should be correct when the transaction execution fails.

In layman’s terms, a transaction is a set of atomic operation units. From a database perspective, it is a set of SQL instructions. Either all of them are executed successfully. If there is an error in the execution of one of the instructions for some reason, the previous execution will be cancelled. all instructions passed. The simpler answer is: either all executions are successful, or they are canceled and not executed.

Since the concept of transaction comes from the database, what is a Java transaction?

In fact, if a Java application system wants to operate a database, it is implemented through JDBC. Addition, modification, and deletion are all implemented indirectly through corresponding methods, and transaction control is also transferred to the Java program code accordingly. Therefore, database operation transactions are customarily called Java transactions.

The above is the detailed content of What is transaction in JAVA. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
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