Spring transactions do not roll back

Source: Internet
Author: User

Staying up late is no good!

I did not roll back the Spring Test just now. I summarized the possible reasons:

1. Whether it is <AOP: Advisor or the annotation used or the AOP of pojo, in short, the configuration or use may be incorrect, the most basic reason.

2. You caught the exception and didn't throw it to let spring know.

3. The method you call is not your own, but inherited (the inherited class implements some of your interfaces, and you have not overloaded them ), spring will not wrap the parent class method, nor will it be wrapped (This point of view is not absolutely proven ). That is, spring only shows the methods of the classes you currently call. The solution is to add @ transactional to your daosupport. It is also clear that the transaction Declaration of the subclass is valid. If the subclass is not declared, it will be found in the parent class.

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.