reele commented on issue #16878:
URL: 
https://github.com/apache/dolphinscheduler/issues/16878#issuecomment-2740204003

   @ruanwenjun 
   finally i found the reason why the transaction didn't rollback
   ```java
       @Transactional
       public IWorkflowExecutionRunnable createWorkflowExecuteRunnable(Command 
command) {
           deleteCommandOrThrow(command);
           return doCreateWorkflowExecutionRunnable(command);
       }
   ```
   
   the `@Transactional` proxy will not roll back if the exception was not 
captured inside of the `@Transactional` proxied function
   
   if capture exception like this, the transaction will work:
   ```java
       @Transactional
       public IWorkflowExecutionRunnable createWorkflowExecuteRunnable(Command 
command) {
           try{
               deleteCommandOrThrow(command);
               return doCreateWorkflowExecutionRunnable(command);
           } catch (Exception e) {
               throw new RuntimeException(e);
           }
       }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to