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

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

    I had the same problem... spent some hours until I found the reason finally. It was just one line of code that caused the exception in my case...

    In my mvc-core-config.xml the following line was the reason:

    
    

    After I changed it as follows, everything worked again:

    
    

    So I guess the scanning of all my application packages instead of just my @Controller classes lead to the problem like @harshal-waghmare mentioned in his post to another answer.

提交回复
热议问题