解决No EntityManager with actual transaction available for current thread

问题描述:

在使用JPA执行删除操作时报错:

No EntityManager with actual transaction available for current thread - cannot reliably process 'remove' call; nested exception is javax.persistence.TransactionRequiredException: No EntityManager with actual transaction available for current thread - cannot reliably process 'remove' call

解决方法:

在对应的@Service或接口上添加@Transactional即可。

猜你喜欢

转载自blog.csdn.net/weixin_44455388/article/details/122544162
今日推荐