-
15. Re: WildFly 14 + Hibernate 5.3.6 results in Caused by: javax.persistence.TransactionRequiredException: Executing an update/delete query
smarlow Sep 19, 2018 9:49 AM (in response to sergiu_pienar)Hi Sergiu,
It would be great if you could occasionally answer a few questions, that might help us recreate this, so you can upgrade to a future WF version and not hit this. We will create a tracking jira soon, to work on this. I'll post the jira link here.
I think that we will try adding a unit test to WildFly, that creates the failure that your hitting. Perhaps we can reuse an existing unit test from https://github.com/wildfly/wildfly/tree/master/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/hibernate, like https://github.com/wildfly/wildfly/blob/master/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/hibernate/SFSBHibernateTransaction.java#L61, which is bootstrapping a session factory.
Did you ever try running WF 13 in EE 8 mode?
./standalone.sh -Dee8.preview.mode=true
Running with EE 8 (preview) mode, will use an earlier version of Hibernate ORM 5.3, I am curious if you see the problems or not with the earlier Hibernate version on WF 13.
Thanks,
Scott
-
16. Re: WildFly 14 + Hibernate 5.3.6 results in Caused by: javax.persistence.TransactionRequiredException: Executing an update/delete query
sergiu_pienar Sep 19, 2018 11:17 AM (in response to smarlow)Hi Scott,
I will try running WF13 in java 8 preview mode tomorrow and will post here.
-
17. Re: WildFly 14 + Hibernate 5.3.6 results in Caused by: javax.persistence.TransactionRequiredException: Executing an update/delete query
smarlow Sep 19, 2018 3:29 PM (in response to sergiu_pienar)I was just reading your server.rar (server.log) again, looking for clues as to how I should recreate the failure. It looks like on the TransactionRequiredException failure, we had just resumed transaction "0:ffffc0a8006a:-47832f48:5b9a6cce:3d6", but I don't see a new Hibernate session being created. When you have a minute, if you could look at line number 109602, in the server.rar that you attached and let me know if you expect that call to org.hibernate.query.internal.AbstractProducedQuery.executeUpdate(), to be done with a newly created Hibernate session or perhaps with that other session that you mentioned, that is kept around.
When you open server.log and goto line 109602, you will see the call stack that shows your involved code, it would be very helpful if you could confirm if the session was perhaps obtained without an active JTA transaction and then used in a JTA transaction.
As far as I can tell from looking at Hibernate 5.1 Query#executeUpdate(), depending on 'shouldAutoJoinTransaction' internal setting, the Query#executeUpdate() could automatically join the JTA transaction. In Hibernate 5.3, AbstractProducedQuery#executeUpdate(), no attempt is made to auto join the transaction. gbadner could you please check this Hibernate ORM code and see what you see.
Scott
-
18. Re: WildFly 14 + Hibernate 5.3.6 results in Caused by: javax.persistence.TransactionRequiredException: Executing an update/delete query
sergiu_pienar Sep 20, 2018 2:21 AM (in response to smarlow)Scott,
" let me know if you expect that call to org.hibernate.query.internal.AbstractProducedQuery.executeUpdate(), to be done with a newly created Hibernate session or perhaps with that other session that you mentioned, that is kept around. "The call at the line you're mentioninig was done with a session that was created for that respective tenant (client, in your terminology). Each such tenant has a session factory of its own, by contrast to the session factory that is created upon app startup and which takes its config. settings from hibernate.cfg.xml. The session that is created upon app startup always worked fine, only the ones created on the fly, as each, tenant is registered are causing the exception (exception that is fixed by setting the hibernate.transaction.factory_class=org.hibernate.transaction.JTATransactionFactory property when creating the session).
I think you are correct in asuming that the session was obtained without a JTA transaction and then used in a JTA transaction.
-
19. Re: WildFly 14 + Hibernate 5.3.6 results in Caused by: javax.persistence.TransactionRequiredException: Executing an update/delete query
smarlow Oct 1, 2018 3:09 PM (in response to sergiu_pienar)Sergiu,
If/when you resume the migration, you might configure hibernate.transaction.coordinator_class=jta which is mentioned in https://github.com/hibernate/hibernate-orm/blob/5.0/migration-guide.adoc.
Scott