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

后端 未结 13 2218
说谎
说谎 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:42

    Ensure that you have an active transaction when this statement executes. If you are using JPA use EntityManager.getTransaction().begin(). This is assuming that you are using JPA outside a JTA transaction scope.

    If you are running the application inside a container with JTA support you can also use JTA UserTransaction to manage transactions.

    0 讨论(0)
提交回复
热议问题