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
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!