Two kinds of mechanism of 25SPRING_ transaction management

Source: Internet
Author: User

There are two types of transaction management mechanisms: Programmatic transaction management and declarative transaction management.

1. The programmatic transaction management enterprise has not been used.

2. We are mainly talking about declarative transaction management. Declarative transaction management, no need to modify the original code, only need to configure, for the target code to add transaction management, AOP underlying implementation---enterprise recommendation

Here's a case: through Spring declarative transaction management. Implement the transfer case.

First step: Build a table;

The table statement is as follows: two accounts in account (AAA and BBB)

CREATE TABLE ' account ' (  ' id ' int (one) not null auto_increment,  ' name ' varchar () ' = ' NOT null ',  ' money ' double DEF  Ault NULL,  PRIMARY KEY (' id ')) engine=innodb auto_increment=4 DEFAULT charset=utf8;insert into ' account ' VALUES (' 1 ', ' AAA ', ' + '); INSERT into ' account ' VALUES (' 2 ', ' BBB ', ' 1000 ');

Step Two: Create a project Spring3_day3_transactionmanager

Import IOC core 4, log 2

Test A

AOP 4 x

JDBC 2 x

Database drives A

C3P0 A

Introduction of Applicationcontext.xml, Db.properties, log4j.properties

Two kinds of mechanism of 25SPRING_ transaction management

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.