Not allowed to create transaction on shared EntityManager - use Spring transactions or EJB CMT

后端 未结 3 1626
闹比i
闹比i 2020-12-29 01:55

This post is in continuation of JPA How to get the value from database after persist

When I execute the following I am getting following exception, how can I resolve

3条回答
  •  渐次进展
    2020-12-29 02:24

    you need to remove entityManager.getTransaction().begin() statement and annotate method using @Transactional which enables spring transactions

提交回复
热议问题