My memory can be corrupted but what i had in mind was to add a flag to say
to use autocommit or not (let's call it schemaToolMode = {AUTOCOMMIT,
COMMIT, BOTH}) and then in the persistence.xml
you can configure the dictionnary with this schemaToolMode property (don't
recall if getters/setters are mandatory but not a real blocker ;))Romain Manni-Bucau @rmannibucau <https://twitter.com/rmannibucau> | Blog <https://blog-rmannibucau.rhcloud.com> | Old Blog <http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> | LinkedIn <https://www.linkedin.com/in/rmannibucau> | JavaEE Factory <https://javaeefactory-rmannibucau.rhcloud.com> 2017-06-13 12:44 GMT+02:00 Francesco Chicchiriccò <[email protected]>: > On 13/06/2017 12:37, Romain Manni-Bucau wrote: > >> Hi Francesco, >> >> kind of have the same analyzis as you. Only mitigation I can do is some >> pool enforce the autocommit mode and therefore autocommit is ignored and >> you still need commit(). Anyway since we have the dictionnary i guess we >> can add a setting there? >> > > Hi Romain, > this makes sense to me, even though I have no idea about how to reference > a specific Dictionary setting from SchemaTool... > > Regards. > > > 2017-06-13 12:32 GMT+02:00 Francesco Chicchiriccò <[email protected]>: >> >> Hi all, >>> at Syncope we have recently switched the application-managed db pool to >>> HikariCP [1]; our (quite intensive, I'd say) tests with H2 and PostgresQL >>> showed no issues at all. >>> >>> Today I am testing MySQL and run unfortunately into a blocking issue: >>> when >>> running the OpenJPA SchemaTool as part of Syncope webapp initialization, >>> an >>> exception is reported by HikariCP: >>> >>> MySQLNonTransientConnectionException: Can't call rollback when >>> autocommit=true >>> >>> No tables are created, and the OpenJPA initialization fails. >>> >>> The reported stacktrace points to [2], from which I would say that the >>> exception is quite right. The strange thing is that when using other >>> connection pool libraries as Commons DBCP2, everything works fine. >>> >>> Can someone explain why rollback is explicitly invoked after setting >>> autocommit to true? (same applies to the commit statement few lines >>> below). >>> >>> Shouldn't it be better to make such behavior optional, anyway? >>> >>> FYI, I have temporarily solved my issue by adding >>> >>> relaxAutoCommit=true >>> >>> to the JDBC URL, and all the integration tests run fine. >>> >>> Please let me have your feedback, thanks. >>> Regards. >>> >>> [1] https://issues.apache.org/jira/browse/SYNCOPE-1084 >>> [2] https://github.com/apache/openjpa/blob/2.4.x/openjpa-jdbc/ >>> src/main/java/org/apache/openjpa/jdbc/schema/SchemaTool.java#L1267 >>> >> > -- > Francesco Chicchiriccò > > Tirasa - Open Source Excellence > http://www.tirasa.net/ > > Member at The Apache Software Foundation > Syncope, Cocoon, Olingo, CXF, OpenJPA, PonyMail > http://home.apache.org/~ilgrosso/ > >
