Hi Micheal,
I tried using the command as described above.
Here is my code snippet:
final ProcessInstance processInstance = executionService.findProcessInstanceById("ServiceCenter.1");
EnvironmentImpl environment =(EnvironmentImpl)((EnvironmentFactory)processService).openEnvironment();
try{
processService.execute(new Command() {
public Object execute(Environment environment)
throws Exception {
Session session = environment.get(Session.class);
Transaction tx = session.beginTransaction();
SwimlaneImpl role = ((ExecutionImpl)processInstance).createSwimlane("approver");
session.update(processInstance);
tx.commit();
System.out.println("Approver role added:"+role);
return role;
}
});
}finally{
environment.close();
}
The ExecutionImpl class has swimlanes map to which this newly created swimlane is inserted. However the map is not lazily getting initialized since the session gets closed somehow.
My jbpm.tx.hibernate.cfg.xml has following configuration:
<?xml version="1.0" encoding="UTF-8"?>
<jbpm-configuration>
<process-engine-context>
<command-service name="txRequiredCommandService">
<skip-interceptor />
<retry-interceptor />
<environment-interceptor />
<standard-transaction-interceptor />
</command-service>
<command-service name="newTxRequiredCommandService">
<retry-interceptor />
<environment-interceptor policy="requiresNew" />
<standard-transaction-interceptor />
</command-service>
<hibernate-configuration>
<cfg resource="jbpm.hibernate.cfg.xml" />
</hibernate-configuration>
<hibernate-session-factory />
</process-engine-context>
<transaction-context>
<transaction />
<hibernate-session />
</transaction-context>
Please tell me is there anything else to be added to this configuration.
Thakns in advance.