使用以下课程,
@Path("/somes")
@RequestScoped
public class SomesResource {
@PersistenceContext(unitName = "some")
private EntityManager entityManager;
@Inject
private SomeService someService;
}
其中,
@Stateless
public class SomeService {
@PersistenceContext(unitName = "some")
private EntityManager entityManager;
}
@PersistenceContext
bean中注入@RequestScoped
?entityManager
中的SomesResource
是否需要在任何修改工作中使用UserTransaction
?entityManager
实际上是否有相同的实例?