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

Stack Overflow | Developer | 5 months ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    Hibernate- illegally attempted to associate a proxy with two open Sessions on creating a new Entity Object

    Stack Overflow | 5 months ago | Developer
    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
  2. 0

    spring -> org.hibernate.HibernateException: Illegal attempt to associate a collection with two open sessions

    Stack Overflow | 2 years ago | Kleber Mota
    org.hibernate.HibernateException: Illegal attempt to associate a collection with two open sessions

    1 unregistered visitors

    Root Cause Analysis

    1. org.hibernate.HibernateException

      illegally attempted to associate a proxy with two open Sessions

      at org.hibernate.proxy.AbstractLazyInitializer.setSession()
    2. Hibernate
      AbstractSaveEventListener.saveWithGeneratedId
      1. org.hibernate.proxy.AbstractLazyInitializer.setSession(AbstractLazyInitializer.java:112)
      2. org.hibernate.engine.internal.StatefulPersistenceContext.reassociateProxy(StatefulPersistenceContext.java:585)
      3. org.hibernate.engine.internal.StatefulPersistenceContext.reassociateIfUninitializedProxy(StatefulPersistenceContext.java:545)
      4. org.hibernate.event.internal.ProxyVisitor.processEntity(ProxyVisitor.java:49)
      5. org.hibernate.event.internal.AbstractVisitor.processValue(AbstractVisitor.java:124)
      6. org.hibernate.event.internal.WrapVisitor.processValue(WrapVisitor.java:125)
      7. org.hibernate.event.internal.AbstractVisitor.processEntityPropertyValues(AbstractVisitor.java:76)
      8. org.hibernate.event.internal.AbstractSaveEventListener.visitCollectionsBeforeSave(AbstractSaveEventListener.java:377)
      9. org.hibernate.event.internal.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:279)
      10. org.hibernate.event.internal.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:195)
      11. org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:128)
      11 frames
    3. Hibernate EJB
      EJB3PersistEventListener.saveWithGeneratedId
      1. org.hibernate.ejb.event.EJB3PersistEventListener.saveWithGeneratedId(EJB3PersistEventListener.java:78)
      1 frame
    4. Hibernate
      SessionImpl.persist
      1. org.hibernate.event.internal.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:208)
      2. org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:151)
      3. org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:78)
      4. org.hibernate.internal.SessionImpl.firePersist(SessionImpl.java:725)
      5. org.hibernate.internal.SessionImpl.persist(SessionImpl.java:701)
      6. org.hibernate.internal.SessionImpl.persist(SessionImpl.java:705)
      6 frames
    5. Hibernate EJB
      AbstractEntityManagerImpl.persist
      1. org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:853)
      1 frame
    6. Java RT
      Method.invoke
      1. sun.reflect.GeneratedMethodAccessor163.invoke(Unknown Source)
      2. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      3. java.lang.reflect.Method.invoke(Method.java:606)
      3 frames
    7. Spring ORM
      ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke
      1. org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:344)
      1 frame
    8. com.sun.proxy
      $Proxy55.persist
      1. com.sun.proxy.$Proxy55.persist(Unknown Source)
      1 frame
    9. net.nationalpayment.cp20
      CreateEntityUtilityImpl.createTransaction
      1. net.nationalpayment.cp20.scheduler.CreateEntityUtilityImpl.createTransaction(CreateEntityUtilityImpl.java:123)
      1 frame
    10. net.nationalpayment.core
      ProcessEnrollmentImpl.run
      1. net.nationalpayment.core.scheduler.ProcessMiscSchedule.processMisc(ProcessMiscSchedule.java:153)
      2. net.nationalpayment.core.scheduler.ProcessDraftSchedule.processDraft(ProcessDraftSchedule.java:287)
      3. net.nationalpayment.core.scheduler.ProcessEnrollmentImpl.processEnrollment(ProcessEnrollmentImpl.java:154)
      4. net.nationalpayment.core.scheduler.ProcessEnrollmentImpl.run(ProcessEnrollmentImpl.java:81)
      4 frames
    11. Java RT
      Thread.run
      1. java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      2. java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      3. java.lang.Thread.run(Thread.java:745)
      3 frames