With following class,
@Path("/somes")
@RequestScoped
public class SomesResource {
@PersistenceContext(unitName = "some")
private EntityManager entityManager;
@Inject
private SomeService someService;
}
Where,
@Stateless
public class SomeService {
@PersistenceContext(unitName = "some")
private EntityManager entityManager;
}
- Question 1: Is it O.K. to be injected with
@PersistenceContextin@RequestScopedbean? - Question 2: Is
entityManagerinSomesResourceneed to be worked with anUserTransactionin any modification job? - Question 3: Are two
entityManagers effectively same instance?