Starting and commit a new transaction inside a delegate transaction context fails

we have a Service task, with a simplified implementation like this:

    public class DelegateCallInterface implements JavaDelegate {

      private IRequestProcessor requestProcessor;

      public void execute(DelegateExecution execution) throws Exception {


When the delegate was successfully executed the transaction commits on camunda side and on our db side (using the same transaction manager). Now let’s say, that an unexpected error ocurred. The transaction will be rollbacked and marked as a failed job.

The implementation of the requestProcessor issimplified as follows:

public class SpecialRequestProcessor implements IRequestProcessor {

    private OwnLogService logService;

    public void process(){
    // some code

    Object o = doSomething(); // this i would like to have inside a seperate transaction, 
    // now i am expecting, that the new transaction is commited, because generateLog was handled inside seperate transaction

    if(o == null){
    // here i throw the exception in order to get a failed job
    throw new RuntimeException("Some exception, which will cause a failed job");
    // rest of the code

    // this is the method i want to execute in each case (also when exception occur. A log has to be saved!!! This method is not part of the interface)
    public Object doSomething(){
    Object object = ...
       // some code where exception can occur< someEntity without>)
       return object;
    }catch(Exception ex){< someEntity with error message>)
    return null;

Assuming something went wrong, null is returned by doSomething and the RuntimeException is thrown. Camunda is rolling back the transaction. But also the log is not saved, although i have explicity declared method “doSomething()” to be inside a seperate transaction. The goal is, to save a log in each case. When everything went well, a succesful log-entity is saved. If an exception occur inside doSomething(), a failing.log-entity has to be saved AND a failed job should be generated by throwing a Runtime Exception after the transaction

How can i realize, that a log is allways saved?

I would be grateful for suggestions. Thanks a lot :slight_smile:

If this is regular java delegate created by engine and not an EJB then I
suspect the annotation has no effect. Just a guess…