org.springframework.orm.jpa.JpaSystemException: org.hibernate.HibernateException: c; nested exception is javax.persistence.PersistenceException: org.hibernate.HibernateException: illegally attempted to associate a proxy with two open Sessions

Searched on Google with the first line of a JAVA stack trace?

We can recommend more relevant solutions and speed up debugging when you paste your entire stack trace with the exception message. Try a sample exception.

Recommended solutions based on your search

Solutions on the web

via Stack Overflow by Developer
, 1 year ago
org.hibernate.HibernateException: c; nested exception is javax.persistence.PersistenceException: org.hibernate.HibernateException: illegally attempted to associate a proxy with two open Sessions
via Stack Overflow by ffM
, 2 years ago
org.hibernate.exception.GenericJDBCException: Cannot open connection; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Cannot open connection
via spring.io by Unknown author, 2 years ago
could not obtain pessimistic lock; nested exception is javax.persistence.PessimisticLockException: could not obtain pessimistic lock
via Stack Overflow by Le Nghi
, 2 years ago
org.hibernate.exception.ConstraintViolationException: Duplicate entry 'nghi' for key 'user_id'; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.ConstraintViolationException: Duplicate entry 'nghi' for key 'user_id'
via Stack Overflow by c4k
, 1 year ago
org.hibernate.TransactionException: Already have an associated managed connection; nested exception is javax.persistence.PersistenceException: org.hibernate.TransactionException: Already have an associated managed connection
via GitHub by degloba
, 1 year ago
Attempt to assign child with key "Department(3)" to parent with key "OrgLineMgmt(no-id-yet)". Parent keys are immutable; nested exception is javax.persistence.PersistenceException: Attempt to assign child with key "Department(3)" to parent with key "OrgLineMgmt(no-id-yet)". Parent keys are immutable
org.hibernate.HibernateException: illegally attempted to associate a proxy with two open Sessions
at org.hibernate.proxy.AbstractLazyInitializer.setSession(AbstractLazyInitializer.java:112)
at org.hibernate.engine.internal.StatefulPersistenceContext.reassociateProxy(StatefulPersistenceContext.java:585)
at org.hibernate.engine.internal.StatefulPersistenceContext.reassociateIfUninitializedProxy(StatefulPersistenceContext.java:545)
at org.hibernate.event.internal.ProxyVisitor.processEntity(ProxyVisitor.java:49)
at org.hibernate.event.internal.AbstractVisitor.processValue(AbstractVisitor.java:124)
at org.hibernate.event.internal.WrapVisitor.processValue(WrapVisitor.java:125)
at org.hibernate.event.internal.AbstractVisitor.processEntityPropertyValues(AbstractVisitor.java:76)
at org.hibernate.event.internal.AbstractSaveEventListener.visitCollectionsBeforeSave(AbstractSaveEventListener.java:377)
at org.hibernate.event.internal.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:279)
at org.hibernate.event.internal.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:195)
at org.hibernate.event.internal.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:208)
at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:151)
at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:78)
at org.hibernate.internal.SessionImpl.firePersist(SessionImpl.java:725)
at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:701)
at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:853)
at sun.reflect.GeneratedMethodAccessor163.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.sun.proxy.$Proxy55.persist(Unknown Source)
at net.nationalpayment.cp20.scheduler.CreateEntityUtilityImpl.createTransaction(CreateEntityUtilityImpl.java:123)
at net.nationalpayment.core.scheduler.ProcessMiscSchedule.processMisc(ProcessMiscSchedule.java:153)
at net.nationalpayment.core.scheduler.ProcessDraftSchedule.processDraft(ProcessDraftSchedule.java:287)
at net.nationalpayment.core.scheduler.ProcessEnrollmentImpl.processEnrollment(ProcessEnrollmentImpl.java:154)
at net.nationalpayment.core.scheduler.ProcessEnrollmentImpl.run(ProcessEnrollmentImpl.java:81)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)

Users with the same issue

Samebug visitor profile picture
Unknown user
Once, 1 year ago
Samebug visitor profile picture
Unknown user
Once, 2 years ago

Write tip

Know the solutions? Share your knowledge to help other developers to debug faster.