3 Replies Latest reply on Feb 14, 2006 5:14 AM by Koen Aers

    Version for Process definition always -1

    Ferosh Newbie

      In the user guide it is stated
      "When a process archive gets deployed, it creates a process definition in the jBPM database. Process definitions can be versioned on the basis of the process definition name. When a named process archive gets deployed, the deployer will assign a version number. To assign this number, the deployer will look up the highest version number for process definitions with the same name and adds 1. Unnamed process definitions will always have version number -1"
      But unforthunately my named process defintions has also version as -1 .
      I tried the example org.jbpm.tutorial.db.HelloDbTest.java which too give the same result.Why this happens ?
      But I remember this was there in JBPM-3 earlier releases .

        • 1. Re: Version for Process definition always -1
          Koen Aers Master

          Hi Ferosh,

          Did you actually deploy, or simply save the processdefinition?


          • 2. Re: Version for Process definition always -1
            Ferosh Newbie

            Yes koen , I deployed and checked the value of version from database
            Is this implemented ? .I have checked the source code.I coudnt make out How the logic is implemented

            • 3. Re: Version for Process definition always -1
              Koen Aers Master


              Locate the GraphSession class in your distribution. There you will find the implementation for deployment of processdefinitions :

              public void deployProcessDefinition(ProcessDefinition processDefinition) {
               String processDefinitionName = processDefinition.getName();
               // if the process definition has a name (process versioning only applies to named process definitions)
               if (processDefinitionName!=null) {
               // find the current latest process definition
               ProcessDefinition previousLatestVersion = findLatestProcessDefinition(processDefinitionName);
               // if there is a current latest process definition
               if (previousLatestVersion!=null) {
               // take the next version number
               processDefinition.setVersion( previousLatestVersion.getVersion()+1 );
               } else {
               // start from 1
               } else {
               throw new JbpmException("process definition does not have a name");