3 Replies Latest reply on Oct 19, 2009 7:54 PM by kukeltje

    [jBPM4] Manually updating DB Entries

      Hi,

      I'm using jBPM 4.1 in a standalone application with the default setup, having switched to MySQL as DB. I need to update some values in the jBPM DB manually and was asking myself what the most convenient and conformant way would be. As I want to access the environment, I thought about doing so using a custom command like this:


      public class UpdateDbCmd implements Command<Object> {
      
       private Object _entry;
      
       public UpdateDbCmd(Object entry) {
       _entry = entry;
       }
      
       public Object execute(Environment environment) throws Exception {
       DbSession session = (DbSession) environment.get(DbSession.class);
      // [...]update the entry
       return null;
       }
      
      }
      


      Then I try to execute the Command like this:

      ProcessEngine eng = new Configuration().buildProcessEngine();
      // [...]
      eng.execute(new UpdateDbCmd(someEntry));
      


      This does result in a NullPointerException as the userCommandService is not defined in the configuration. Unfortunately I haven't found information about how to configure the wire bindings correctly. Could anyone please point me in the right direction or suggest another way how to update db entries manually.

      Thanks

        • 1. Re: [jBPM4] Manually updating DB Entries
          mwohlf

          I have the following setup in my jbpm.cfg.xml file, inside the process-engine-context:

           <command-service name="user.command.service">
           <retry-interceptor />
           <environment-interceptor />
           <spring-transaction-interceptor current="true"/>
           </command-service>
          


          but I don't really remember where this is documented

          • 2. Re: [jBPM4] Manually updating DB Entries

            Thanks mwohlf, that works. Configuring command services is mentioned in the developers guide, but it wasn't quite clear to me how to use it, now I am beginning to understand :)

            • 3. Re: [jBPM4] Manually updating DB Entries
              kukeltje

              keep in mind though that things in the dev guide are *not supported*. In this case that means they are not fully stabilized yet and can change in the future. They have matured enough though to be in the dev guide, so you can expect certain things not to change 180 degrees