0 Replies Latest reply on Apr 4, 2006 8:51 AM by Daniel Zhang

    how to move processdefinition between databases

    Daniel Zhang Newbie

      in my process, developer will create processdefinition in design db, when finished, should move it to production DB, I tried to define 2 sets of configure files pointing to different DB, and the logic is as below,

      JbpmContext jbpmContext = JbpmConfiguration.getInstance("jbpm-prod.cfg.xml").createJbpmContext();
      ProcessDefinition pd=jbpmContext.getGraphSession().findLatestProcessDefinition("testpd");
      JbpmContext jbpmContext1 = JbpmConfiguration.getInstance("jbpm-design.cfg.xml").createJbpmContext();
      jbpmContext1.getGraphSession().saveProcessDefinition(pd);


      but at the step of "saveProcessDefinition(pd)", error occurs as followed



      org.hibernate.HibernateException: Illegal attempt to associate a collection with two open sessions
      at org.hibernate.collection.AbstractPersistentCollection.setCurrentSession(AbstractPersistentCollection.java:410)
      at org.hibernate.event.def.WrapVisitor.processCollection(WrapVisitor.java:44)
      at org.hibernate.event.def.AbstractVisitor.processValue(AbstractVisitor.java:101)
      at org.hibernate.event.def.WrapVisitor.processValue(WrapVisitor.java:98)
      at org.hibernate.event.def.AbstractVisitor.processEntityPropertyValues(AbstractVisitor.java:55)
      at org.hibernate.event.def.AbstractSaveEventListener.visitCollectionsBeforeSave(AbstractSaveEventListener.java:333)
      at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:250)
      at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:167)
      at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:101)
      at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:186)
      at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33)
      at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:175)
      at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27)
      at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
      at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:544)
      at org.hibernate.impl.SessionImpl.save(SessionImpl.java:533)
      at org.hibernate.impl.SessionImpl.save(SessionImpl.java:529)
      at org.jbpm.db.GraphSession.saveProcessDefinition(GraphSession.java:90)
      at com.sinocos.cos.wf.test.LoopProcessBean.migrateProcessDefn(LoopProcessBean.java:313)
      at com.sinocos.cos.wf.test.TestMigrateProcessDefinition.main(TestMigrateProcessDefinition.java:8)
      2006-4-4 20:47:34 org.jbpm.db.GraphSession saveProcessDefinition
      ??: org.hibernate.HibernateException: Illegal attempt to associate a collection with two open sessions
      org.jbpm.JbpmException: closed JbpmContext in different order then they were created... check your try-finally's around JbpmContexts blocks
      at org.jbpm.JbpmContext.popThisContextFromTheStack(JbpmContext.java:503)
      at org.jbpm.JbpmContext.close(JbpmContext.java:140)
      at com.sinocos.cos.wf.test.LoopProcessBean.flashContext(LoopProcessBean.java:305)
      at com.sinocos.cos.wf.test.LoopProcessBean.migrateProcessDefn(LoopProcessBean.java:316)
      at com.sinocos.cos.wf.test.TestMigrateProcessDefinition.main(TestMigrateProcessDefinition.java:8)


      please give some advices, thanks a lot.