Hibernate JPA and Spring javax.persistence.TransactionRequiredException: no transaction is in progress

后端 未结 13 2215
说谎
说谎 2020-12-05 17:52

When I call:

entityManager.flush()

I get the exception mentioned in the title.

I am using Hibernate JPA.

13条回答
  •  有刺的猬
    2020-12-05 18:19

    Same was happening to me using spring 3.0.0 / 3.0.3. Data was persisted in MySQL from JUnit but not from the tomcat server. After so much work I gave up on RESOURCE_LOCAL for JTA.

    This worked for me http://erich.soomsam.net/2007/04/24/spring-jpa-and-jta-with-hibernate-and-jotm/ It uses JTA and depends on JOTM.

提交回复
热议问题