on-internet
← Community

"org.hibernate.HibernateException: Illegal attempt to associate a collection with two open sessions" even when the context is Thread

Stack Overflow ·

In my application(server) I create a Hibernate session in the beginning of request processing using "sessionFactory.openSession()". I retrieve the object make some changes to it in some other class and then do a saveOrUpdate as follows: Session session = sessionFactory.getCurrentSession(); Transaction dbTransaction = session.getTransaction(); dbTransaction.begin(); session.saveOrUpdate(entity); dbTransaction.commit() I have also set the below property in the configuration file. <property name="hibernate.current_session_context_class">thread</property> However when I do a session.saveOrUpdate(e

Comments

Sign in or sign up to comment and upvote.

No comments yet.