Transaction does not work Closing non transactional sqlsession

Source: Internet
Author: User

in proxy mode (which was the default), only external method calls coming in through the proxy is intercepted. This means is self-invocation, in effect, a method within the target object calling another method of the target object, Would not leads to a actual transaction at runtime even if the invoked method was marked with @Transactional .

Spring Document Address:

http://docs.spring.io/spring/docs/4.2.0.RC1/spring-framework-reference/htmlsingle/#transaction-declarative-annotations

Description: In proxy mode, only external method calls are intercepted and transactions are opened. Class internal calls cannot implement transaction control.

Error Example:

 Public class Tx {        publicvoid  A () {        B ();    }         = propagation.required)    publicvoid  B () {            }}

Correct example:

 Public class Tx {        = propagation.required)    publicvoid  A () {        B ();    }              Public void B () {            }}

Transaction does not work Closing non transactional sqlsession

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.