Patch looks aligned to what i had in mind. +1
Romain Manni-Bucau @rmannibucau <https://twitter.com/rmannibucau> | Blog <https://rmannibucau.metawerx.net/> | Old Blog <http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> | LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book <https://www.packtpub.com/application-development/java-ee-8-high-performance> Le jeu. 28 juin 2018 à 15:23, Francesco Chicchiriccò <[email protected]> a écrit : > Hi, > I was trying to open a issue and attach my proposed patch there for > review, but JIRA appears to be unaccessible right now... > > Anyway, you can find the patch (against trunk) at > > https://paste.apache.org/qPBh > > I have tried with MySQL 8 and it works just fine. > > Please let me have your feedback before I commit it. > Regards. > > On 27/06/2018 17:42, Romain Manni-Bucau wrote: > > add a field _skipAutoCommit (find a better name ;)), add a setter > > setSkipAutoCommit, call the setter in static utilities (run and main I > > think), finally use the boolean and you are done > > > > Le mer. 27 juin 2018 à 17:40, Francesco Chicchiriccò < > [email protected]> > > a écrit : > > > >> On 27/06/2018 17:32, Romain Manni-Bucau wrote: > >>> Hi Francesco, > >>> > >>> this is overall quite weird and I think other things will be broken > since, for instance, EE will try to do the same in all servers. > >>> > >>> Anyway, for the config flag, the dictionary (_dict) can be a location > but I would prefer the schematool itself (like we already have droptables > etc) > >> +1 > >> (but I have no idea about how to do that...) > >> > >> Regards. > >> > >>> Le mer. 27 juin 2018 à 17:28, Francesco Chicchiriccò < > [email protected]> a écrit : > >>> > >>> Hi all, > >>> I am resurrecting this old thread (for which I have found an even older > >>> reference [1]), because I have recently tried with the latest 8.x MySQL > >>> JDBC driver, which has removed the 'relaxAutoCommit' option [2]; as a > >>> result, now I am stuck exactly with the same error explained below. > >>> > >>> I have tried by locally removing the lines > >>> > >>> > https://github.com/apache/openjpa/blob/2.4.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/SchemaTool.java#L1254-L1269 > >>> > >>> and everything works like a charm. > >>> > >>> What would be the simplest way to make the lines above optional by > >>> configuration? > >>> > >>> Regards. > >>> > >>> [1] > https://lists.apache.org/thread.html/53b0e83f37aa9a8f9c06a67fb7a948487efe1a6941d4b9fae1404858@1394724819@%3Cusers.openjpa.apache.org%3E > >>> [2] > https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-properties-changed.html > >>> > >>> On 13/06/2017 12:57, Romain Manni-Bucau wrote: > >>> > >>> 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 ;)) > >>> > >>> 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/ > >
