Transactions of database operations are customarily called Java transactions
1. What is a Java transaction
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.
# instruction. 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? What's the connection?
2. Why transactions are needed
3. Types of Java transactions
There are three types of Java transactions: JDBC transactions, JTA (Java Transaction API) transactions, and container transactions.
1. JDBC transactions
JDBC transactions are controlled by Connection objects. The JDBC Connection interface (java.sql.Connection) provides two transaction modes: automatic submission and manual submission. java.sql.Connection provides the following methods to control transactions:
public void setAutoCommit(boolean)
public boolean getAutoCommit()
public void commit()
public void rollback()
1. Detailed explanation of Java transaction management learning JDBC sample code
2. Java transaction management learning Detailed introduction to Hibernate
3. Java transaction management learning: Detailed code explanation of Spring and Hibernate
###The above is the detailed content of Summary of personal understanding of Java transactions. For more information, please follow other related articles on the PHP Chinese website!