3 Replies Latest reply on Nov 10, 2009 12:26 AM by msahai

    Jboss jbpm 4.2 integration with spring

    msahai

      Hi community,

      i have started using jboss jbpm 4.2 and managed to integrate it with spring.

      i am able to deploy the sample process defintion and able to getProcessInstance , but when
      i query for processInstance.getId() it is coming as null.
      i had taken a look at source code and found out that id generation is done within Executionimpl class:
      protected void composeIds() {
      this.id = IdComposer.getIdComposer().createId(processDefinition, parent, this);
      } and id composer is Databaseid composer or memoryIdComposer.

      and default id generator implementation returns null for all process instances.

      i also see <id-generator> in jbpm.cfg.xml and thinks that its value must be overridden somehow.
      database used is mysql.

      thanks
      mayank

        • 1. Re: Jboss jbpm 4.2 integration with spring
          mwohlf

          Hi msahai,

          I think you are missing

          <object class="org.jbpm.pvm.internal.id.DatabaseIdComposer" init="eager" />
          


          in your jbpm.cfg.xml

          • 2. Re: Jboss jbpm 4.2 integration with spring
            msahai

            hi mwohlf,

            i did not get it properly.where i have to add this line.
            do i have to add it within <id-generator> tag.
            can you show me sample cfg , to which you are refering too.

            my sample cfg is:

            <?xml version="1.0" encoding="UTF-8"?>

            <jbpm-configuration>





            <process-engine-context>
            <repository-service />
            <repository-cache />
            <execution-service />
            <history-service />
            <management-service />
            <identity-service />
            <task-service />

            <!-- Here we needed to change the transaction interceptor -->
            <command-service name="txRequiredCommandService">
            <skip-interceptor />
            <retry-interceptor />
            <environment-interceptor />
            <spring-transaction-interceptor transactionManager="transactionManager"/>
            </command-service>

            <command-service name="newTxRequiredCommandService">
            <retry-interceptor />
            <environment-interceptor policy="requiresNew" />
            <spring-transaction-interceptor transactionManager="transactionManager"/>
            </command-service>


            <!-- Added spring as read-context -->
            <script-manager default-expression-language="juel"
            default-script-language="juel"
            read-contexts="execution, environment, process-engine, spring"
            write-context="">
            <script-language name="juel"
            factory="org.jbpm.pvm.internal.script.JuelScriptEngineFactory" />
            </script-manager>



            <id-generator/>


            <address-resolver />

            <business-calendar>






            </business-calendar>

            <mail-template name='task-notification'>

            ${task.name}
            <![CDATA[Hi ${task.assignee},
            Task "${task.name}" has been assigned to you.
            ${task.description}

            Sent by JBoss jBPM
            ]]>
            </mail-template>

            <mail-template name='task-reminder'>

            ${task.name}
            <![CDATA[Hey ${task.assignee},
            Do not forget about task "${task.name}".
            ${task.description}

            Sent by JBoss jBPM
            ]]>
            </mail-template>



            </process-engine-context>

            <transaction-context>
            <repository-session />
            <db-session />

            <message-session />
            <timer-session />
            <history-session />
            <mail-session>
            <mail-server>
            <session-properties resource="jbpm.mail.properties" />
            </mail-server>
            </mail-session>

            <!-- Need to set explicitly that we don't want jbpm to create sessions -->
            <hibernate-session current="true" />
            </transaction-context>
            </jbpm-configuration>

            • 3. Re: Jboss jbpm 4.2 integration with spring
              msahai

              ok i got it,

              thanks for help

              mayank sahai