1 Reply Latest reply on Sep 21, 2005 10:35 AM by jsanmarco

    JbpmSession - HibernateException: Found shared references to

    jsanmarco

      Hi all,
      I have a proccess definition that has a decision node DN1. One condition makes DN1 transition to a previous step in the process and other condition causes DN1 transition to an end state.
      When I try to save a processInstance (the current state of teh process), I get this exception:

      ERROR JbpmSession : org.hibernate.HibernateException: Found shared references to a collection
      java.lang.RuntimeException: couldn't commit transaction
       at org.jbpm.db.JbpmSession.commitTransaction(JbpmSession.java:107)
       at com.lumina.jbpm.test.TestWaitWF.theProcessInstanceContinuesWhenAnAsyncMessageIsReceived(TestWaitWF.java:176)
       at com.lumina.jbpm.test.TestWaitWF.testSimpleProcess(TestWaitWF.java:38)
       at com.lumina.jbpm.test.TestWaitWF.main(TestWaitWF.java:183)
      Caused by: org.hibernate.HibernateException: Found shared references to a collection
       at org.hibernate.engine.Collections.processReachableCollection(Collections.java:130)
       at org.hibernate.event.def.FlushVisitor.processCollection(FlushVisitor.java:37)
       at org.hibernate.event.def.AbstractVisitor.processValue(AbstractVisitor.java:104)
       at org.hibernate.event.def.AbstractVisitor.processValue(AbstractVisitor.java:64)
       at org.hibernate.event.def.AbstractVisitor.processEntityPropertyValues(AbstractVisitor.java:58)
       at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:198)
       at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:190)
       at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:70)
       at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
       at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:730)
       at org.jbpm.db.JbpmSession.commitTransaction(JbpmSession.java:102)
       ... 3 more


      Are ciclyc graphs supported in jbpm?

      Best regards,

      Juan Manuel

        • 1. Re: JbpmSession - HibernateException: Found shared reference
          jsanmarco

          Hi,
          the HibernateException wasn't related to the cyclic aspect of the process definition.
          In some action class I had the following:

          SimpleVO vo = (SimpleVO) processInstance.getContextInstance().getVariable("simpleVO");
          vo.setValue(newValue);
          processInstance.getContextInstance().setVariable("simpleVO",vo);


          The second time this action was executed caused the org.hibernate.HibernateException: Found shared references to a collection.

          To solve this problem I did the following:
          SimpleVO vo = (SimpleVO) processInstance.getContextInstance().getVariable("simpleVO");
          vo.setValue(newValue);
          //delete the old variable first
          processInstance.getContextInstance().deleteVariable("simpleVO");
          processInstance.getContextInstance().setVariable("simpleVO",vo);


          The difference is the previous deletion of the variable 'simpleVO'. I don't know if there is a better way to modify a variable rather than deleting and recreating it.

          Regards,
          Juan Manuel