# PostgreSQL: Cannot commit when autoCommit is enabled

**URL:** <https://forum.flowable.org/t/postgresql-cannot-commit-when-autocommit-is-enabled/8343>\
**Category:** Flowable Engine\
**Created:** [September 1, 2021, 11:40am UTC](https://forum.flowable.org/t/postgresql-cannot-commit-when-autocommit-is-enabled/8343 "2021-09-01T11:40:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ilgrosso](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/ilgrosso/32/116_2.png) [@ilgrosso](https://forum.flowable.org/u/ilgrosso)\
**Post date:** [September 1, 2021, 11:40am UTC](https://forum.flowable.org/t/postgresql-cannot-commit-when-autocommit-is-enabled/8343/1 "2021-09-01T11:40:19Z")

</div>

I am experiencing the issue [previously reported](https://forum.flowable.org/t/postgresql-autocommit/4284) with Flowable 6.7.0 (not v5) and PostgreSQL (no errors with 6.6.0).

The full stacktrace is

```auto
org.apache.openjpa.persistence.PersistenceException: Cannot commit when autoCommit is enabled.
syncope_1 | at org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:408)
syncope_1 | at org.springframework.orm.jpa.DefaultJpaDialect.translateExceptionIfPossible(DefaultJpaDialect.java:128)
syncope_1 | at org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:538)
syncope_1 | at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:743)
syncope_1 | at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:711)
syncope_1 | at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:152)
syncope_1 | at org.flowable.common.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:57)
syncope_1 | at org.flowable.common.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:30)
syncope_1 | at org.flowable.common.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:56)
syncope_1 | at org.flowable.eventregistry.impl.EventRegistryEngineImpl.<init>(EventRegistryEngineImpl.java:47)
syncope_1 | at org.flowable.eventregistry.impl.EventRegistryEngineConfiguration.buildEventRegistryEngine(EventRegistryEngineConfiguration.java:195)
syncope_1 | at org.flowable.eventregistry.spring.SpringEventRegistryEngineConfiguration.buildEventRegistryEngine(SpringEventRegistryEngineConfiguration.java:73)
syncope_1 | at org.flowable.eventregistry.spring.configurator.SpringEventRegistryConfigurator.initEventRegistryEngine(SpringEventRegistryConfigurator.java:57)
syncope_1 | at org.flowable.eventregistry.spring.configurator.SpringEventRegistryConfigurator.configure(SpringEventRegistryConfigurator.java:47)
syncope_1 | at org.flowable.common.engine.impl.AbstractEngineConfiguration.configuratorsAfterInit(AbstractEngineConfiguration.java:1107)
syncope_1 | at org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl.init(ProcessEngineConfigurationImpl.java:1012)
syncope_1 | at org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl.buildProcessEngine(ProcessEngineConfigurationImpl.java:900)
syncope_1 | at org.flowable.spring.SpringProcessEngineConfiguration.buildProcessEngine(SpringProcessEngineConfiguration.java:76)

```

As said above, it works flawlessly with other DBMS as MySQL and H2.

Any suggestion?

---

<div class="post-metadata">

**Author:** ![filiphr](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/filiphr/32/315_2.png) [@filiphr](https://forum.flowable.org/u/filiphr)\
**Post date:** [September 1, 2021, 12:03pm UTC](https://forum.flowable.org/t/postgresql-cannot-commit-when-autocommit-is-enabled/8343/2 "2021-09-01T12:03:33Z")

</div>

Interesting problem, this happens when the event registry Schema is created. We are using the `TransactionTemplate` since that’s how the engine is configured to control the transactions.

Did you only upgrade Flowable or you also upgraded other dependencies, like Spring JPA in the same time?

You could also try to see what happens when you use the `TransactionTemplate` using the `PlatformTransactionManager` from Spring.

If you do without Flowable

```auto
TransactionTemplate transactionTemplate = new TransactionTemplate(transactionManager);
            transactionTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
            transactionTemplate.execute(status -> {
                // do nothing
                return null;
            })

```

you should be able to pinpoint the problem better I think. In the end this is what we do in the `SpringTransactionInterceptor`

---

<div class="post-metadata">

**Author:** ![ilgrosso](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/ilgrosso/32/116_2.png) [@ilgrosso](https://forum.flowable.org/u/ilgrosso)\
**Post date:** [September 1, 2021, 12:22pm UTC](https://forum.flowable.org/t/postgresql-cannot-commit-when-autocommit-is-enabled/8343/3 "2021-09-01T12:22:31Z")

</div>

The only upgrade was Flowable - see [Upgrading Flowable · apache/syncope@b76306c · GitHub](https://github.com/apache/syncope/commit/b76306ca086f03b55d7f351aac274f8a49eca2ac)

Since we don’t seem to need the Event Registry at all, for the moment I am applying as workaround the following change to our conf:

```auto
conf.setDisableEventRegistry(true);

```
