1

I am doing this tutorial on Hibernate: https://netbeans.org/kb/docs/web/hibernate-webapp.html

My issue: After I am done with the instructions and run the project, I get Hibernate Error: "Severe: org.hibernate.TransactionException: nested transactions not supported"

I tried "tx.commit();" to close the transaction but that didn't change anything.

question: why did it work when the tutorial people wrote the instructions but not working now? and how to get it to work?

1 Answer 1

1

change

    public FilmHelper() {
        this.session = HibernateUtil.getSessionFactory().getCurrentSession();
    }

to

    public FilmHelper() {
        this.session = HibernateUtil.getSessionFactory().openSession();
    }

Reason: Tutorial uses Hibernate 3 and now I am using Hibernate 4. In Hibernate3, once transaction is complete it is closed and the same session is allowed to open a new transaction w/ NoProblem. In Hibernate4, once transaction is complete it is still open. if a developer close it then the session close with it. developer has to manually open a new session.

If anyone knows more about Hibernate and like to add to this, please comment below me.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.