Declarative transactions: Configure transactions in a configuration file, invoke spring's transactions through beans, and do not require code-based transaction management in the program, such as Commit,backroll.
Programmatic transactions: You need to include the logic of handling transactions in your code, and you may need to display the methods in your code that call BeginTransaction (), commit (), rollback (), such as transactions that are required to execute a method, You need to open the transaction at the start of the A method, after processing. At the end of the method, the transaction is closed.
Transactions are designed to ensure the consistency and integrity of the data and to ensure that the entire operation is atomic (that is, indivisible), that the transaction is either all executed, or that it is not executed at all. If all the child transactions of a transaction are committed successfully, all database operations are committed, the database state is transformed, and if there is a child transaction failure, the database operations of the other child transactions are rolled back, that is, the database returns to the state before the transaction execution, and no state transitions occur. The same is true for spring or XXX transactions.
Declarative transactions and programmatic transactions