Spring transactions

Hi Everyone,

According to the documentation here

When passing the DataSource to the SpringProcessEngineConfiguration (using property “dataSource”), Flowable uses a org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy internally, which wraps the passed DataSource. This is done to make sure the SQL connections retrieved from the DataSource and the Spring transactions play well together

I have a application embedding Flowable engine and my configuration look like this

@Configuration
public class ProcessEngineConfig {
  
  @Autowired
  private DataSource dataSource;
  
  @Autowired
  private PlatformTransactionManager transactionManager;
       
  @Bean
  public ProcessEngineConfigurationImpl processEngineConfiguration() {
    SpringProcessEngineConfiguration config = new SpringProcessEngineConfiguration();
    config.setDataSource(dataSource);
    config.setTransactionManager(transactionManager);
    config.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE);
    return config;
  }

  @Bean
  public ProcessEngine processEngine() {
    ProcessEngine processEngine = processEngineConfiguration().buildProcessEngine();
    return processEngine;
  }
  
  @Bean
  public RepositoryService repositoryService() {
      return processEngine().getRepositoryService();
  }
  
  @Bean
  public RuntimeService runtimeService() {
      return processEngine().getRuntimeService();
  }
  
  @Bean
  public HistoryService historyService() {
      return processEngine().getHistoryService();
  }
  
  @Bean
  public ManagementService managementService() {
      return processEngine().getManagementService();
  }

I continually have this exception thrown when having task executed back to back

org.flowable.common.engine.api.FlowableOptimisticLockingException: HistoricTaskInstanceEntity[id=17669] was updated by another transaction concurrently

Could someone help ?

Just to let you know … my application is a Springboot app (from flowable-spring-boot-starter) and that the spring configuration snippet bellow is me trying to force the datasource to be wrapped in a TransactionAwareDataSourceProxy whit no success i guess