7 Replies Latest reply on May 31, 2006 7:44 AM by Ronald van Kuijk

    ProcessInstance id

    Patrick van Amstel Newbie


      How is de ProcessInstance id set?

      It always returns a 0 for me.

      I've looked inside the code and the only reference made
      to the id member of the processInstance is in the getId method.

      Am i missing something?

      grt Patrick

        • 1. Re: ProcessInstance id
          Ronald van Kuijk Master

          it is only set if you use persistency. Otherwise it is indeed always 0.

          Setting the id is a hibernate thing. If you do want to use it in some way, you could use in-memory hsqldb.

          • 2. Re: ProcessInstance id
            Patrick van Amstel Newbie

            An other stupid question then.

            I think i am using persisantcy becuase i can see things happening in the database.

            Is it a property that needs to be set on the processInstance?
            Or has it something to do with the process logging?

            Or something totally different.

            thx Patrick

            • 3. Re: ProcessInstance id
              Patrick van Amstel Newbie


              My question is not correct i think.

              Here is the code that saves the process instance.

              Am i correct when the context is closed the processInstance is removed from the database.

              And if i do not want that.

              I want to keep track of my processInstances. How do i do that?
              So the second time around when this code is executed i want to have a processInstance id of 2.

              bpmContext context1 = null;
              ProcessDefinition pd = ProcessDefinition.parseXmlResource("FileSplitter.par/processdefinition.xml");
              context1 = this.jbpmConfiguration.createJbpmContext();

              ProcessInstance instance = new ProcessInstance(pd);

              } catch (Exception e)
              }finally {

              • 4. Re: ProcessInstance id
                Patrick van Amstel Newbie

                Ok firther on my quest.

                I isee the process instance id's increasing.

                But when i close the jbpmContext and rerun the program the processInstance id's start from 0.

                Is it possible to increase them even if i close the jbpmContext?

                Searching further on my own.

                thx Patrick

                • 5. Re: ProcessInstance id
                  Patrick van Amstel Newbie

                  Ok stupid me found it

                  when you do a jbpmConfiguration.createSchema(); the processInstance are dropped.

                  But still a bit in the dark. When do you use the jbpmConfiguration.createSchema() and drop schema.

                  And does anyone add javadoc to the code. And if not i want to add my findings in the java doc as a total nit wit.

                  grt Patrick

                  • 6. Re: ProcessInstance id
                    Ronald van Kuijk Master

                    I use createScheme() just in unittests so I'm sure I have a clean database.

                    Normally you would do this while installing jBPM (by using the generated sql and have the DBA run it for you.

                    You could add some javadoc to the code, but better would be to start an 'after getting started' page on the wiki with some advanced api usage.

                    with regard to the javadoc, post patches in the developer forum. If Tom thinks they are ok, he can grant you write access eventually.

                    • 7. Re: ProcessInstance id
                      Ronald van Kuijk Master

                      btw, thanks for reporting back and being so investigative. Refreshing from time to time.