我们有一个树层,核心层,biz和api。
基本上,我们有一些使用entityManager
进行保存,更新和更多操作的方法。
在biz层中,我们称为核心方法。在Api层中,我们有其余的API控制器可以调用服务。
我不明白为什么当我们多次调用调用在其上使用@Transactional
的方法的方法时,为什么必须使用entityManager
注释。
如果我不使用@Transactional
注释,则会出现此异常
No EntityManager with actual transaction available for current thread - cannot reliably process 'persist' call