0 Replies Latest reply on Sep 27, 2012 7:20 AM by Santosh Singh

    jBPM-4.4 Unable to save Process Variable History

    Santosh Singh Newbie

      Hello Everyone,

      I have requirement where i need to show tracking of an workflow. However history for task, Activity, Process intances are saved into corresponding history tables.

      But while browsing through JBPM4_HIST_VAR table , i am unable to get ani information about process variables.

      please see the following code.

       

       

      ProcessInstance pInstance =

      executionService

       

       

       

      Map<String, Object> params = new HashMap<String, Object>();

      params.put("SubmittalCoordinator", "HO-DWG");

      params.put("CivilDepartment", "HO-CIVIL");

      params.put("MechanicalDepartment", "HO-MECH");

      ProcessInstance pInstance = executionService.startProcessInstanceByKey("workflowStatus", params);

      executionService.setVariable(pInstance.getId(), "ProcessInstanceId", "workflowStatus");

       

       

      repositoryService.createDeployment().addResourceFromClasspath("insight/abg/jbpm/workflowStatus.jpdl.xml").setName("workflowStatus").deploy();

          ProcessInstance pInstance = executionService

            .startProcessInstanceByKey(instanceKey, params);

          executionService.setVariable(pInstance.getId(), "ProcessInstanceId", pInstance);

          ((ExecutionImpl)pInstance).createVariable("someString", "SomeString","string",true);

          Variable variable =  ((ExecutionImpl)pInstance).getVariableObject( "SomeString");                    

          HistoryEvent.fire(new VariableCreate(variable));

         

      //    EnvironmentImpl environment = ((EnvironmentFactory) processEngine).openEnvironment();

      //    try {

      //         ((ExecutionImpl)pInstance).createVariable("someString", "SomeString","string",true);

      //     Session session = environment.get(Session.class);

      //     Transaction tx  = session.beginTransaction();

      //     session.update(pInstance);

      //     tx.commit();

      //    } finally {

      //        environment.close();

      //    }

       

      While debugging I am able to see data in variable object, but it is not getting save in JBPM4_HIST_VAR table.

      Can anyone help me?

       

      Thanks in advance .

      Regards,

      Santosh