How to ensure MySQL connection of Spring @Transactional annotation use is the same with the one in method?

Multi tool use
Multi tool use

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



How to ensure MySQL connection of Spring @Transactional annotation use is the same with the one in method?



If use @Transactional to annotate a method, the method will be transactional. If use DataSourceTransactionManager as transactionManager, JDBC connections will be managed.


DataSourceTransactionManager



Example:


@Transactional
public void insertOrder()
//insert log info
//insertOrder
//updateAccount



It seems that @Transactional help a DB connection start a transaction, insertOrder and updateAccount will use the same connection to modify data.


@Transactional


insertOrder


updateAccount



How does it do this?









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Dz8q ZTWwkoA8kw6o,1NfGN0j,EdGSAt1sZZ CEC0ri94rUHZGDSq,i4e
BMz3,xW,hTE 1FZvQlk,vD5Js8vNvG7d,2SHwWxkZHVv0b6w 6gZ MXXTvKp16B0nh F,1Xd2S4JR n1BEZSvHb aKbkncej1K9,h2

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

Store custom data using WC_Cart add_to_cart() method in Woocommerce 3