JBoss Community

[Q] JBPM 4.4 JbpmException

reply from Michael Wohlfart in jBPM - View the full discussion

The problem is there is a database session needed if you call some of the methods, especially on the persistent objects like task, execution, process etc.... that's just the nature of mapping objects to a database, it is not a bug...

 

you can:

  • stick with the methods of the services (RepositoryService, IdentityService, etc)
  • open/close an environment that manages the session for you (see developers guide section 6.5):
    EnvironmentImpl environment = (EnvironmentImpl) ((EnvironmentFactory)processEngine).openEnvironment();
    try {
      // do yout stuff here
    } finally {
      environment.close();
    }
  • create a command that is executed by the process engine (see developers guide section 6.6):
    processEngine.execute(new Command() {
      public Object execute(Environment env) {
        // do your stuff here
        return null;
      }
    });

Reply to this message by going to Community

Start a new discussion in jBPM at Community