Spring Business Awareness

Source: Internet
Author: User

Spring Configuration Exception rollback takes the Rollback-for= "Businessexception".
The difference between a check exception and a non-checked exception from Java.
Using spring will inevitably use spring's transaction management, and it is natural to use transaction management to choose Declarative transaction management, in the spring documentation, spring declarative transaction management defaults to non-checked exceptions and runtime exceptions for transaction rollback, A rollback operation is not performed on a check-type exception.
So what is a check-type exception and what is a non-check exception?
The simplest point of judgment is two:
1. A non-check exception that inherits from RuntimeException or error, and inherited from exception is a check-type exception (of course, runtimeexception itself is also a subclass of exception).
2. The non-check type exception can not be captured, and the check type exception must be handled with a try statement block or the exception to the superior method processing, in short, must write code to deal with it. So you have to catch the exception at the service and then throw it again, so the transaction just works.

--Quote http://cn-done.iteye.com/blog/775519

Also found MySQL database needs to set the table type to: InnoDB support transactions, otherwise the transaction will not be effective. ~!!

Spring Business Awareness

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.