Transaction is required to perform this operation (either use a transaction or extended persistence context)

后端 未结 6 1821
迷失自我
迷失自我 2020-12-20 14:27

I\'m using Wildfly 10.0.0 Final, Java EE7, Maven and JPA 2.1. When I am querying my database for records it works fine and lists out the employees, but when I am trying to p

6条回答
  •  感动是毒
    2020-12-20 15:00

    An alternate way to handle this is to use the annotation @Transactional on your DataFetchBean's method addEmployee. Then you don't need the UserTransaction and can use AOP to manage the transaction.

    This was a new feature added in JTA 1.2.

提交回复
热议问题