3 Replies Latest reply on Oct 19, 2009 7:54 PM by Ronald van Kuijk

    [jBPM4] Manually updating DB Entries

    Philip Sorst Newbie

      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