EJBException when calling entityManager.getTransaction()

后端 未结 2 873
再見小時候
再見小時候 2020-12-18 01:06

This is probably something trivial, but I\'d love some help.

I get:

 javax.ejb.EJBException: java.lang.IllegalStateException: Illegal to call this me         


        
2条回答
  •  天涯浪人
    2020-12-18 01:54

    You don't need to instantiate the EntityManager by hand, your container does that for you because of the @PersistenceContext annotation. Also, you don't need to begin the transaction manually, it's also provided by your containter. Just use your em field and forget about the other ones.

提交回复
热议问题