Exception: transaction not successfully started

Source: Internet
Author: User
Exception: org. hibernate. transactionexception: transaction not successfully started
Error code: service layer session = hibernateutils. getcurrentsession ();//.... database Operation Statement (called Dao layer) Transaction Tx = session. begintransaction (); Tx. commit (); Dao layer session = hibernateutils. getcurrentsession ();//.... database Operation statement transaction Tx = session. begintransaction (); Tx. commit ();
Exception details:
![](http://i2.51cto.com/images/blog/201811/01/b3a475128fe693546c7d8d34cefac421.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
Check the analysis and find the cause:
Originally, I created two transaction objects in the same thread, which violates the isolation in the acid feature of the transaction.
Solution:
Remove the repeated transaction code at the DaO layer as follows: Transaction Tx = session. begintransaction (); Tx. Commit ();

Exception: transaction not successfully started

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.