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
@PersistenceContext
in@RequestScoped
bean? - Question 2: Is
entityManager
inSomesResource
need to be worked with anUserTransaction
in any modification job? - Question 3: Are two
entityManager
s effectively same instance?