I am saving sessions in a static variables and retrieving sessions from those static variables inside ebj. The error is even if I say the completeWorkItem(..) inside ejb or outside it, but always in a separate thread, the persistence context is not flushed. Essentially the workiteminfo entry is not removed for that workitem and nodeinstancelog and processinstancelog tables are also not updated. So there is inconsistency in the process state. But if i perform a new operation( any operation that will do some database transaction on jbpm database) like starting new process instance the persistence context is flushed.