Spring - No EntityManager with actual transaction available for current thread - cannot reliably process 'persist' call

前端 未结 15 1534
自闭症患者
自闭症患者 2020-11-30 20:08

I get this error when trying to invoke \"persist\" method to save entity model to database in my Spring MVC web application. Can\'t really find any post or page in internet

相关标签:
15条回答
  • 2020-11-30 20:35

    I had the same problem and I added tx:annotation-driven in applicationContext.xml and it worked.

    0 讨论(0)
  • 2020-11-30 20:36

    I removed the mode from

    <tx:annotation-driven mode="aspectj"
    transaction-manager="transactionManager" />
    

    to make this work

    0 讨论(0)
  • 2020-11-30 20:38

    boardRepo.deleteByBoardId(id);

    Faced the same issue. GOT javax.persistence.TransactionRequiredException: No EntityManager with actual transaction available for current thread

    I resolved it by adding @Transactional annotation above the controller/service.

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