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

前端 未结 15 1595
自闭症患者
自闭症患者 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:30

    I had this issue for days and nothing I found anywhere online helped me, I'm posting my answer here in case it helps anyone else.

    In my case, I was working on a microservice being called through remoting, and my @Transactional annotation at the service level was not being picked up by the remote proxy.

    Adding a delegate class between the service and dao layers and marking the delegate method as transactional fixed this for me.

提交回复
热议问题