What is the difference between @Inject and @PersistenceContext?
问题 In a project using JPA, I commonly use @Inject EntityManager em; in order to obtain such an object. I saw that many code snippets in the web instead use: @PersistenceContext EntityManager em; What is the difference between these options? My code runs on JBoss EAP 6.1 and Hibernate. 回答1: @PersistenceContext is a specific annotation that declares a dependency on a container-managed entity manager. It allows you to specify more parameters like the persistence type. Setting the persistence type