"TransactionRequiredException: no transaction is in progress" during flush of application managed entity manager in JBoss EAP
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 7.2
- 7.3
- Hibernate
- 5.3
Issue
-
An application managed entity manager is created.
-
A JTA transaction is initiated (e.g. during a CMT or BMT context)
-
During
EntityManager.flush()an exception is raised... javax.persistence.TransactionRequiredException: no transaction is in progress -
No exception occurred in Hibernate 5.1 / EAP 7.1.
Resolution
- This issue1 is resolved in This content is not included.EAP 7.3 cumulative patch (CP) 3 and later releases. Production systems should use the latest available cumulative patch.
- As a workaround,
EntityManager.joinTransaction()may be called explicitly before callingflush().
Root Cause
This is a known defect (Content from hibernate.atlassian.net is not included.HHH-13936).
Components
Category
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.