How to avoid nested transactions not supported error?

前端 未结 5 1792
借酒劲吻你
借酒劲吻你 2020-12-08 05:15

I need to make sure many concurrent users be able to access the database. Although after each commit I close the session but sometimes my code runs into following error, but

5条回答
  •  青春惊慌失措
    2020-12-08 05:25

    I faced a similar issue : org.hibernate.TransactionException: nested transactions not supported

    In my case, I opened a session and tried saving . Without commit, I called another method and called session.beginTransaction(); So it throw the error. In order to avoid, I sent the session object as a method parameter and just called session.save instead of again doing begin. Practically used the session object. It worked for me!

提交回复
热议问题