I assumed that the end() method of the processInstance would act like a 'catch-all' and flushes the log.Assumptions are always dangerous ;-) Why not assume that when signalling a token/process would do the same?
Seriously... to me there is no difference. I just have to make sure I always do this... just like with any plain hibernate thing...
Indeed, assuming that it happens when signalling a token would do the same.
But when I checked the sourcecode, this ain't happening.
The ProcessLogs are added to the LoggingInstance, but the problem is that this are non-persisted objects at that point.
Until the call to the jbpmContext.save(processInstance) is made, resulting in calling the loggingService which will do a session.save(ProcessLog), Hibernate simply does *not* know the ProcessLogs.
In my point of view, this is quite error-prone (you *have* to call the jbpmContext.save() method).
Simply doing a session.save(ProcessLog) after the ProcessLog creation will do the trick. Hibernate will then persist the ProcessLog when it flushes its session.