1 Reply Latest reply on Sep 16, 2007 2:16 PM by dfrenkiel

    can't update or delete variables

    dfrenkiel

      hello.

      i can successfully create process variables but i can't update or delete them.

      i have hibernate logging sql queries and it does nothing with new or deleted variables.

      here's some code where i'm trying to delete a variable called "phoneNumber"

      after running this code the process instance still has the variable.

      =======================

      ProcessInstance processInstance = jbpmContext.loadProcessInstanceForUpdate(8);

      ContextInstance contextInstance = processInstance.getContextInstance();

      contextInstance.deleteVariable("phoneNumber");

      jbpmContext.save(processInstance);
      jbpmContext.close();

      =======================

      the result is the same if i try to update the variable - it remains unchanged.

      is there something else i need to do to enable variable updates and deletes?

      thanks very much for any assistance.
      david f.

        • 1. Re: can't update or delete variables
          dfrenkiel

          after some more experimentation i am able to change variables by explicitly saving the token variable map.

          for example, to update a date variable:

          Token rootToken = processInstance.getRootToken();

          contextInstance.setVariable("timeNow", new Date(), rootToken);
          saveHibernateObject(contextInstance.getTokenVariableMap(rootToken));

          so it appear to be just a hibernate cascade issue or something.

          or is this just the way it needs to be done?

          thanks.
          david f.